Page 1 of 2 12>
Topic Options
#92756 - 2003-09-09 09:22 AM .PutEx
IRa Offline
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
#92757 - 2003-09-09 10:44 AM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
fail with what error code?
_________________________
!

download KiXnet

Top
#92758 - 2003-09-09 10:52 AM Re: .PutEx
IRa Offline
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
#92759 - 2003-09-09 10:59 AM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
I would try this simple change to your line:
code:
$ObjUser.PutEx(3,"otherMailbox",$NewMail[0]) @Error ?

anyway, I must wonder.
objects about never give real errors.
this says it straight though. it doesn't like PutEx
_________________________
!

download KiXnet

Top
#92760 - 2003-09-09 11:27 AM Re: .PutEx
IRa Offline
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
#92761 - 2003-09-09 11:32 AM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
ok, can I ask you from now start using the code-tags when you post code.
it rather hard to find your comments in the midst [Wink]

ok, how come you assume or know the putEx takes the e-mail addy as array?

anyway, this:
code:
$OMailbox=$ObjUser.GetEx("otherMailbox")
$IMax=UBound($oMailbox) $IMax ?
ReDim Preserve $oMailbox[$IMax]
$oMailbox[$IMax]="smtp$$xx@@test.dk"

seems to me just the same as:
code:
$OMailbox=$ObjUser.GetEx("otherMailbox")
$oMailbox[UBound($oMailbox)]="smtp$$xx@@test.dk"

_________________________
!

download KiXnet

Top
#92762 - 2003-09-09 11:50 AM Re: .PutEx
IRa Offline
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 Offline
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
#92764 - 2003-09-09 11:59 AM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
could you try with this piece and say does they all look  -

code:
$ObjUser=GetObject("LDAP://"+$Server+"/CN="+$User+",CN=Recipients,OU="+$Site+",o="+$Org)
$oMailbox=$ObjUser.GetEx("otherMailbox")

"mailbox before change:"
for each $value in $oMailbox
? $value
next
$oMailbox[UBound($oMailbox)]="smtp$$xx@@test.dk"
? ? "and after:"
for each $value in $oMailbox
? $value
next

not sure but think it comes to com-object arrays...
try it out but might be you need to find another way to do this [Wink]
_________________________
!

download KiXnet

Top
#92765 - 2003-09-10 12:01 AM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
second question.
you mean the code?
wasn't a question [Wink]
_________________________
!

download KiXnet

Top
#92766 - 2003-09-10 12:13 AM Re: .PutEx
IRa Offline
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
#92767 - 2003-09-10 12:23 AM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
ok.
then, say how this does work:
code:
$ObjUser=GetObject("LDAP://"+$Server+"/CN="+$User+",CN=Recipients,OU="+$Site+",o="+$Org)
$oMailbox=$ObjUser.GetEx("otherMailbox")
$val=$oMailbox[UBound($oMailbox)]
$oMailbox[UBound($oMailbox)]="SMTP$$xx@@test.dk"
redim preserve $oMailbox[UBound($oMailbox)+1]
$oMailbox[UBound($oMailbox)]=$val

$ObjUser.PutEx(2,"otherMailbox",$oMailbox)

btw, I see you found the quote-button [Wink]
willing to try the code-button too? [Big Grin]

[ 09. September 2003, 12:24: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#92768 - 2003-09-10 12:34 AM Re: .PutEx
IRa Offline
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
#92769 - 2003-09-10 12:46 AM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
dude...
you could try outputting a mailbox which already has an smtp addy.
to see do we have the correct format at all.
_________________________
!

download KiXnet

Top
#92770 - 2003-09-10 12:54 AM Re: .PutEx
IRa Offline
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 [Confused]

(found the gremlins as well)

Top
#92771 - 2003-09-09 01:04 PM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
k, finally bothered looking at msdn.
this is vbs sample:
quote:
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


like you see, the addresses are not put in with putEx()
do you have a sample link that does it with that?
_________________________
!

download KiXnet

Top
#92772 - 2003-09-09 01:16 PM Re: .PutEx
IRa Offline
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) [Smile]

Top
#92773 - 2003-09-09 03:22 PM Re: .PutEx
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
well, according to the documentation, the "aothermailbox" is just a bogus null.
there is nothing passed with it.
_________________________
!

download KiXnet

Top
#92774 - 2003-09-09 03:34 PM Re: .PutEx
Howard Bullock Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#92775 - 2003-09-09 04:18 PM Re: .PutEx
IRa Offline
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 [Confused]

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
Page 1 of 2 12>


Moderator:  Shawn, ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (adamlevine) and 165 anonymous users online.
Newest Members
katherinknul, phamthuy, xuantu075, skygreen2031, amelindare
17629 Registered Users

Generated in 0.08 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org