Page 1 of 1 1
Topic Options
#123100 - 2004-07-15 09:43 PM Using PutEx in 4.22
ItsMillerTime4u Offline
Fresh Scripter

Registered: 2004-07-15
Posts: 5
Does anyone know why the following code doesn't work using kix4.22 final release?

$objUser = GetObject("LDAP://server/CN=User,OU=Group,DC=site,DC=com")
? @ERROR

;Clear any current entries
objUser.PutEx(1,"otherTelephone",0)

;Add the new entries
objUser.PutEx(3,"otherTelephone","111-111-1111")
? @SERROR
objUser.PutEx(3,"otherTelephone","222-222-2222")
? @SERROR
objUser.PutEx(3,"otherTelephone","333-333-3333")
? @SERROR
objUser.PutEx(3,"otherTelephone","444-444-4444")
? @SERROR
objUser.SetInfo


The error string I get at each line is
COM exception error "PutEx" (Active Directory - Unspecified error) [-2147352567/80020009]

Top
#123101 - 2004-07-15 09:48 PM Re: Using PutEx in 4.22
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
putEx had something special in it.
just cant remember.
something like, not implemented for automation interface...
_________________________
!

download KiXnet

Top
#123102 - 2004-07-15 09:53 PM Re: Using PutEx in 4.22
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
And you're also missing a '$' on your objUser vars.
_________________________
Eric

Top
#123103 - 2004-07-15 10:08 PM Re: Using PutEx in 4.22
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I have no problem with PutEX in this script.
Code:
BREAK ON

$ADS_PROPERTY_CLEAR = 1
;$NewHomeDrive = 'O:'
$NewHomeDrive = ''
$ = SetOption('WrapAtEol','on')
$users = GetObject('LDAP://ou=Users,ou=bla,ou=bla,dc=mycompany,dc=local')
for each $user in $users
if $user.class = 'USER'
;if $user.HomeDirectory <> ''
;$NewHomeDirectory = '\\mycompany.local\bla\home\users\' + $user.sAMAccountName
$NewHomeDirectory = ''
$HomeDirectory = $user.HomeDirectory
'Current HomeDirectory for ' +$user.sAMAccountName ' is: ' + $user.HomeDirectory ?
' - Modified to: ' + $NewHomeDirectory ?
'Current HomeDrive for ' +$user.sAMAccountName ' is: ' + $user.HomeDrive ?
' - Modified to: ' + $NewHomeDrive ?
$user.HomeDirectory = $NewHomeDirectory
$user.HomeDrive = $NewHomeDrive
$user.PutEX($ADS_PROPERTY_CLEAR,'HomeDirectory','')
$user.PutEX($ADS_PROPERTY_CLEAR,'HomeDrive','')
$user.SetInfo
;endif
endif
next

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#123104 - 2004-07-15 10:42 PM Re: Using PutEx in 4.22
ItsMillerTime4u Offline
Fresh Scripter

Registered: 2004-07-15
Posts: 5
missing the $ was just a typo on my end here. The actaul kix file was on a another system.

I don't have any problem using the PutEx to clear the current values that may be present, the errors only occur when I then try to append the new values to the attribute. I know that the following VB code works:
objUser.PutEx(2,"otherTelephone",Array("111-111-1111","222-222-2222","333-333-3333","444-444-4444"))
objUser.SetInfo


but I'm not sure how to translate the Array portion into KiX

Top
#123105 - 2004-07-15 10:45 PM Re: Using PutEx in 4.22
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
$array = "111-111-1111","222-222-2222","333-333-3333","444-444-4444"
objUser.PutEx(2,"otherTelephone",$array)
objUser.SetInfo

_________________________
!

download KiXnet

Top
#123106 - 2004-07-15 10:51 PM Re: Using PutEx in 4.22
ItsMillerTime4u Offline
Fresh Scripter

Registered: 2004-07-15
Posts: 5
That worked.......Thank You!
Top
#123107 - 2004-07-15 10:54 PM Re: Using PutEx in 4.22
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The answer would have come quicker and easier had you told the whole story in the first place.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.065 seconds in which 0.031 seconds were spent on a total of 12 queries. Zlib compression enabled.

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