Page 1 of 1 1
Topic Options
#91849 - 2003-03-31 11:03 AM how to clear a property
ebiard Offline
Fresh Scripter

Registered: 2003-03-13
Posts: 14
I don't manage to clear a property.
I always get an error back when .SetInfo is done.
Thanks.

Top
#91850 - 2003-03-31 11:07 AM Re: how to clear a property
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ebiard,

I can only guess here :

.SetInfo ....

Have you assigned the Property set to a variable ? Unless you do so you may get Idispatch Pointers not allowed errors (or similar)

So try (pseudo-code!):

code:
$whatever = $Object.SetInfo

or even:

code:
$object.SetInfo. 

hth

[ 31. March 2003, 11:07: Message edited by: jpols ]
_________________________



Top
#91851 - 2003-03-31 11:39 AM Re: how to clear a property
ebiard Offline
Fresh Scripter

Registered: 2003-03-13
Posts: 14
@SERROR after .SetInfo :
COM exception error "SetInfo" ((null) - (null)) [-2147352567/80020009]

code :
$AD=GetObject("...")
For Each $User in $AD
$User.cramBac=$Bac
...
$User.SetInfo
?@SERROR
...

if $Bac is empty or "", it does not work.
Of course, cramBac property exists for the object.

Top
#91852 - 2003-03-31 11:46 AM Re: how to clear a property
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hmmmm ... If I translate the com error with Chris' fnCOMErr() it returns

quote:
9 - The storage control block address is invalid.
think it's time to show the complete script(or at least a supposed to work snippet) [Wink]

[ 31. March 2003, 11:48: Message edited by: jpols ]
_________________________



Top
#91853 - 2003-04-01 12:03 AM Re: how to clear a property
ebiard Offline
Fresh Scripter

Registered: 2003-03-13
Posts: 14
Let's go for this short example :
code:
$User=GetObject("LDAP://CN=testattr,OU=testattrib,OU=testcitrix,OU=Informatique,OU=Siege,DC=w2k,DC=cram10,DC=cnav")
?$User.fullname
$User.fullname=""
$User.SetInfo
?@SERROR
Get $x


Top
#91854 - 2003-04-01 12:07 AM Re: how to clear a property
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
And that's the point I have to leave this thread:

Still no LDAP provider here [Mad]
_________________________



Top
#91855 - 2003-03-31 01:10 PM Re: how to clear a property
ebiard Offline
Fresh Scripter

Registered: 2003-03-13
Posts: 14
Don't [Mad] so fast, thank you.
You can moify the code with "LDAP://server/...", this doesn't change anything. [Wink]

Top
#91856 - 2003-03-31 01:17 PM Re: how to clear a property
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
You mean WINNT:// as provider ?

that'd be a possibility ... wait-o
_________________________



Top
#91857 - 2003-03-31 01:27 PM Re: how to clear a property
ebiard Offline
Fresh Scripter

Registered: 2003-03-13
Posts: 14
[Smile] Works fine with WinNT provider !
Why not with the LDAP provider ? It would have been easier for me (got to directly point a specific OU).
Thanks.

Top
#91858 - 2003-03-31 01:54 PM Re: how to clear a property
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
TBH,

I am totally out of the loop, not only that I won't even get any chance to test on LDAP (Win Nt environment here) but also the only thing I can actually generate with WINNT provider is 'Invalid class string' [Embarrassed]

I feel like a complete 1D10T [Frown]
_________________________



Top
#91859 - 2003-03-31 02:18 PM Re: how to clear a property
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ok, bypassed my DOH-mode and used getobject instead of createobject [Roll Eyes]



break on

$obj = getobject("WinNT://SomeDomain")

$obj.Filter = "User",""

for each $usr in $obj
    if $usr.Name = "whatever"
        $usr.Fullname = "John Doe"
        $usr.SetInfo
    endif
next




... does work of course

Still I can't exactly tell why this won't work with the LDAP provider [Frown]

Anyone ?

[ 31. March 2003, 14:19: Message edited by: jpols ]
_________________________



Top
#91860 - 2003-03-31 02:50 PM Re: how to clear a property
ebiard Offline
Fresh Scripter

Registered: 2003-03-13
Posts: 14
Well...
Seems that i really need to make it work with the LDAP provider because :
I need to change properties (and also clear them) that are not system based. These were implemented with a schema extension of the user class.
And... These kind of properties are not seen with the WinNT provider...
AFTER SOME TESTING (on the same object) :
- WINNT : ok to view, fill or empty any system based property. but cannot address extented-schema based properties.
- LDAP : ok to view or fill any type of property. but cannot empty any.
Thanks for your help (maybe i missed something ?).

Top
#91861 - 2003-03-31 05:27 PM Re: how to clear a property
ebiard Offline
Fresh Scripter

Registered: 2003-03-13
Posts: 14
[Smile] FOUND IT! [Smile]

It works when using the PutEx method (see msdn-PutEx)
like :
code:
$<object>.PutEx(1,<property>,"")
$<object>.SetInfo

1 is for "ADS_PROPERTY_CLEAR".

Thanks again for your help.

Top
#91862 - 2003-03-31 05:33 PM Re: how to clear a property
Stevie Offline
Starting to like KiXtart
*****

Registered: 2002-01-09
Posts: 199
Try changing
$usr.Fullname = "John Doe" to
$usr.Properties("FullName") = "John Doe"
_________________________
Stevie

Top
Page 1 of 1 1


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

Who's Online
0 registered and 532 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.064 seconds in which 0.04 seconds were spent on a total of 11 queries. Zlib compression enabled.

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