#92776 - 2003-09-09 05:06 PM
Re: .PutEx
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
$NewMail[0]="smtp$$xx@@test.com"
What is "$$xx" in the above string?
Does this translate to smtp:user@test.com? I know the double @'s are correct.
The Perl example deals with the data being return as a single value or as an array if multiple values exist. In all cases the code rebuilds the array to write back to the property.
I am a little confused by your last post.
Before we get into all that thought. Do you have any existing data in this property alreadt on any mailboxes? If yes, can you succesfully extract the data? If no, can you add some data via the Exchange admin program to test reading the data? [ 09. September 2003, 17:08: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#92777 - 2003-09-09 05:20 PM
Re: .PutEx
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
On a test mailbox can you get the following to work to replace what is there or to add the first item?
$ObjUser.PutEx(2,"otherMailbox",$NewMail) @Error ?
|
|
Top
|
|
|
|
#92778 - 2003-09-09 05:25 PM
Re: .PutEx
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Also what version of KiXtart are you using?
Try:
Dim $NewMail[0] instead of $NewMail[1]
|
|
Top
|
|
|
|
#92779 - 2003-09-09 05:26 PM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
1. The E-mail Addresses (otherMailbox) syntax = smtp$user@test.com In Kix entered as: "smtp$$user@@test.com" (tried "smtp"+"$$"+"user@@test.com" with same result).
Yes it translates to: smtp$user@test.com
2. I have existing X400, SMTP Primary, MS and CCMail addresses, and want to add one or more secondary SMTP Addresses.
3. Yes, I can sucessfully retreive the data to an array with a GetEx statement. I can even add the same array back, as long as I dosn't add to or modify anything in the array.
|
|
Top
|
|
|
|
#92780 - 2003-09-09 05:36 PM
Re: .PutEx
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If you can use PutEx(2,...
You may be able to get the $oldarray,
for each item in $oldarray build a $newarray
Then PutEx(2, "otherMailbox", $newarray)
|
|
Top
|
|
|
|
#92781 - 2003-09-09 05:40 PM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Tried the "Dim $NewMail[0]"
It made a difference; now the PutEx is accepted (returncode 0), however the value entered into Excange Admin is: ???????k (with no mailtype)
From logging: "LDAP modify request contains value 浳灴砤䁸整瑳搮k. "
How come $NewMail is passed as garbage? To me it looks like ADSI is expecting a reference to the elements in the array rather then the strings itself?!
Kixtart is ver. 4.02
Running on a NT 4.0 server with ADSI Provider 2.5. Tried running from a Win2K pro with same result.
|
|
Top
|
|
|
|
#92782 - 2003-09-09 05:42 PM
Re: .PutEx
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
KiXtart 4.02 has some COM issues. Please try again with 4.21.
Have you tried using PutEx (2, ... instead putEx(3, ...? [ 09. September 2003, 17:44: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#92783 - 2003-09-09 06:12 PM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
1. Tried Ver 4.21, and even 4.22 RC, - same result
2. Tried PutEx(2...), it replaces first mail entry (ccmail) with: "???????k"
|
|
Top
|
|
|
|
#92784 - 2003-09-09 07:15 PM
Re: .PutEx
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sorry to say I am at a loss at this point. I do not have a test exchange environment with which I can try this.
I know that GetInfoEx had problems and will be fixed in the production release of 4.22. Maybe there are some other PutEx issues as well.
In the past I was able to successfully use PutEX with Perl. So maybe this is a KiXtart issue. Can anyone get this to work with KiXtart or replicate the failure?
|
|
Top
|
|
|
|
#92785 - 2003-09-09 08:28 PM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Found this at MSDN (Active Directory Services Interface in the Microsoft Exchange 5.5 Environment):
code:
Note that in VBScript, it is necessary to CStr() string values to properly format the data for ADSI: objNewDL.Put "cn", CStr(strDisplayName) objNewDL.Put "uid", CStr(strAliasName) objNewDL.Put "distinguishedName", CStr("cn=" + strAliasName + ",cn=Recipients,ou=" + strSite + ",o=" + strOrganization) objNewDL.Put "mail", CStr(strSMTPAddr) This code creates a multivalued property. In VBScript you have to de-reference the array by using parentheses: objNewDL.PutEx ADS_PROPERTY_UPDATE, "otherMailbox", (aOtherMailbox)
objNewDL.Put "Report-To-Originator", True objNewDL.Put "Report-to-Owner", False objNewDL.Put "Replication-Sensitivity", CInt(20) objNewDL.Put "rfc822Mailbox", CStr(strSMTPAddr) objNewDL.Put "textEncodedORaddress", CStr(strx400Addr) objNewDL.SetInfo
Response.Write "DL Created Successfully!<BR><BR>"
I tried CStr'ing the E-Mail string before PuEx'ing it to no avail.
Can anyone figure out if the: quote: it is necessary to CStr() string values to properly format the data for ADSI
and the: quote: In VBScript you have to de-reference the array by using parentheses
makes an issue in Kix?
|
|
Top
|
|
|
|
#92787 - 2003-09-09 09:59 PM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
In the "Mail-Recipient (person) Object Class" Table, in the "Exchange Name" Column, is listed: "Proxy-Addresses"
The corresponding "LDAP Name" Column lists: quote: mail, rfc822Mailbox,OtherMailbox, textEncodedORAddress
And the corresponding "Comment" Column says: quote: The list of foreign mail system addresses for this recipient. This attribute is exposed as follows: Primary SMTP address - mail Primary X.400 address - textEncodedORAddress other addresses - otherMailbox
Furthermore it is used 4 times in the examples.
I agree it's wake, but it's there, and it works
(this is the level of documentation I have come to expect, dealing with M$ technologies )
|
|
Top
|
|
|
|
#92788 - 2003-09-11 05:09 AM
Re: .PutEx
|
Mark Austrin
Lurker
Registered: 2003-09-11
Posts: 1
|
I had the same issue trying to update a custom attribute for a product called DirectorySmart.
I found no way thru Kixtart to successfully use .putex, but I did come up with a work-around.
The workaround involves the creation of a temporary VBscript, and the execution of this script. See the example below:
code:
; this example will add 3 entries to the otherIpPhone attribute for user Jim Smith
Break ON
CLS
$phone1="phone1" $phone2="phone2" $phone3="phone3"
$setdn = Chr(34)+"LDAP://w2kbase.sandbox.ca/cn=Jim Smith,ou=TestOU,dc=sandbox,dc=ca"+Chr(34)
; chr(34) is double-quote
Del "c:\tempvbs.vbs"
Open(2,"c:\tempvbs.vbs",5)
WriteLine(2,"Const ADS_PROPERTY_UPDATE = 2 ")+@CRLF WriteLine(2,"Set objUser = GetObject _")+@CRLF WriteLine(2,"("+$setdn+")")+@CRLF WriteLine(2,"objUser.PutEx ADS_PROPERTY_UPDATE, _")+@CRLF WriteLine(2,Chr(34)+"otherIpPhone"+Chr(34)+", Array"+Chr(34)+"("+$phone1+Chr(34)+","+Chr(34)+$phone2+Chr(34)+","+Chr(34)+$phone3+Chr(34)+")")+@CRLF
WriteLine(2,"objUser.SetInfo")+@CRLF Close(2)
? "Press anykey to spawn tempvbs.vbs" Get $anykey
Shell "cmd.exe /c c:\tempvbs.vbs"
? "Done" Get $gg
Hope this helps
|
|
Top
|
|
|
|
#92790 - 2003-09-11 09:37 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Thank's MA, it's a great suggestion.
Since I'm coding for a NT platform, it requires VBS installed, and then I might as well do the whole thing in VBS where it's known to work.
However it got around the failure; Luckily you can create an import file and import it to Exchange.
I created an importfile with the new addresses, and then made the script import the file to Exchange, - it works.
Thank's to all for chippin in.
|
|
Top
|
|
|
|
#92792 - 2003-09-11 10:46 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
The whole task was; To change Exchange mail aliases and add a secondary E-mail address with the new alias, then adjust the SAM/loginname accordingly. An input file lists current an new aliases.
I did all the tasks that was possible by ADSI (LDAP:/WinNT:).
Since I could not PutEx the new E-mail addresses (as Exchange requires), the script writes them to a CSV Import file, which the script subsequently commands Exchange to import.
Best regards.
|
|
Top
|
|
|
|
#92793 - 2005-01-05 09:05 PM
Re: .PutEx
|
redniels
Fresh Scripter
Registered: 2002-10-21
Posts: 19
Loc: Netherlands
|
Just curious: when was this fixed? and what was the problem? cause I was fighting the whole day with kix 4.21 with this same problem, and only now, at this non work hour i came up with the brilliant idea of trying it on kix 4.23.. and behold.. it works..
so.. enlighten me...what was wrong in previous versions?
|
|
Top
|
|
|
|
#92794 - 2005-01-06 02:26 AM
Re: .PutEx
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|