#92756 - 2003-09-09 09:22 AM
.PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Anyone have a clue on this?
Trying to PutEx an extra E-mail address in Exchange as follows:
code:
$Server="Serverx" $Site="Sitex" $User="Userx" $Org="Orgx" $UserDN="$Server/CN=$User,CN=Recipients,OU=$Site,o=$Org" $ObjUser=GetObject("LDAP://$UserDN") Dim $NewMail[1] $NewMail[0]="smtp$$xx@@test.com" $ObjUser.PutEx(3,"otherMailbox",$NewMail) @Error ? $ObjUser.SetInfo @Error ? $ObjUser.PutEx returns "1" $ObjUser.SetInfo returns "0"
Why does the PutEx fail? Any thoughts welcome [ 09. September 2003, 14:23: Message edited by: Chris S. ]
|
Top
|
|
|
|
#92758 - 2003-09-09 10:52 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
"$ObjUser.PutEx" fails with a returncode of "1" "$ObjUser.SetInfo" suceeds with a returncode of "0"
IADs::PutEx syntax: PutEx(Long, BStr, Variant)
Could the "Long" or "BStr" be the problem (all Kix variables = Variant) ?
|
Top
|
|
|
|
#92760 - 2003-09-09 11:27 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
No, dosn't work either - returns "1".
I tried this:
code:
$Server="Serverx" $Site="Sitex" $User="Userx" $Org="Orgx" $UserDN="$Server/CN=$User,CN=Recipients,OU=$Site,o=$Org" $ObjUser=GetObject("LDAP://$UserDN") $OMailbox=$ObjUser.GetEx("otherMailbox") $IMax=UBound($oMailbox) $IMax ? ReDim Preserve $oMailbox[$IMax] $oMailbox[$IMax]="smtp$$xx@@test.dk" $ObjUser.PutEx(2,"otherMailbox",$oMailbox) @Error ?
Epl.: Retreiving the original E-Mail Addresses Array, and adding the New Mail Address, then replacing the whole thing with PutEx(2,...).
This is accepted (returncode 0), however in Exchange the added E-Mail Address is listed as: ???????k (with no message type).
Logging reveals: "LDAP modify request contains value CCMAIL$Test, Userx at Sitex." "LDAP modify request contains value MS$Orgx/Sitex/Userx." "LDAP modify request contains value 浳灴砤䁸整瑳搮k."
From last log line it appears there are somthing wrong in the valuetype passed
What on earth... [ 09. September 2003, 14:22: Message edited by: Chris S. ]
|
Top
|
|
|
|
#92762 - 2003-09-09 11:50 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
1. I base the assumption on several VBS codesamples, here is one from the ADSI SDK: quote: x.PutEx ADS_PROPERTY_APPEND, "OtherhomePhone", Array("333-3333")
2. Your right, it appears the same, however some difference must exist in the stored string format, as the first 2 elements in the array are accepted and the third appears as garbage.
I guess getting the array preserves the stringformat if you don't mess with it.
Listing the VarType() for each element gives 8 (string) for all elements, including the added one (Ruud?).
Sorry obout the quoting
|
Top
|
|
|
|
#92763 - 2003-09-09 11:53 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Sorry again
Answer to your second question:
2. Yes it's the same (and generates same error)
|
Top
|
|
|
|
#92766 - 2003-09-10 12:13 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Produces: quote: mailbox before change: CCMAIL$Test, Test1 at Horsholm MS$LSG/HORSHOLM/TEST1 ???????k
and after: CCMAIL$Test, Test1 at Horsholm MS$LSG/HORSHOLM/TEST1 smtp$xx@test.dk
|
Top
|
|
|
|
#92768 - 2003-09-10 12:34 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
(Added a .SetInfo)
The PutEx is accepted. In Exchange the added address is: ???????k.
Logging reveals same garbage as before instead of proper E-mail Address.
|
Top
|
|
|
|
#92770 - 2003-09-10 12:54 AM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Yes, already did. When failing I don't thrust books, however in this case the book format and the real life format matches. Only not the PutEx
(found the gremlins as well)
|
Top
|
|
|
|
#92772 - 2003-09-09 01:16 PM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
You have the reference in your very first line: quote: objNewDL.PutEx ADS_PROPERTY_UPDATE, "otherMailbox", (aOtherMailbox)
The quote: objNewDL.Put "rfc822Mailbox", CStr(strSMTPAddr)
sets the primary E-mail Address (return address), "otherMailbox" sets additional E-mail Addresses (and that is what I need)
|
Top
|
|
|
|
#92774 - 2003-09-09 03:34 PM
Re: .PutEx
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Please review this post.
http://aspn.activestate.com/ASPN/Mail/Message/278010
Could this be part of your issue? I can put this into KiXtart terms if you believe you have the same issue.
|
Top
|
|
|
|
#92775 - 2003-09-09 04:18 PM
Re: .PutEx
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
LK: The documentation is quit scarce and from time to time contradictionary and gives no insight. The working examples are the ones to learn from.
As I can GetEx "otherMailbox", it can't be all bogus. I can PutEx as well, it only, for some reason, passes garbage to the PutEx method, when I populate the elements my self, but not if I pass the previously GetEx'ed values
HB: Yes, it's the exact same thing I am trying to accomplish. I'm not fluent in Perl, so your translation is appreciated.
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 248 anonymous users online.
|
|
|