Question Equivalent of "obj.PutEx ADS"

stubar

Member
Joined
Nov 9, 2010
Messages
5
Programming Experience
1-3
Hello
My question concerns a crossover of VBSCRIPT to DotNet, but here goes

I have a project in VB.NET concerning users in AD. Basically they are disabled but need to be enabled again. This means clearing the AUTHORIG property.

If I was doing it in VBSCRIPT i would simply use obj.PutEx ADS_PROPERTY_CLEAR, "authorig", 0 but I can't find the equivalent in DotNet

I can set it, as below, but can't clear it. Any advice?

Dim dey As DirectoryEntry = New DirectoryEntry("LDAP://.... Blah")
Dim authorig As PropertyValueCollection = dey.Properties("authorig"
authorig = dey.Properties("authorig")
Dim colarray() As Object = {"DistinginguishedName"}
authorig.Value = colarray
dey.CommitChanges()
 

stubar

Member
Joined
Nov 9, 2010
Messages
5
Programming Experience
1-3
Reply: Equivalent of "obj.PutEx ADS" in VB.NET

Hello
Thanks for the quick reply but that's the vbscript code
obj.PutEx ADS_PROPERTY_CLEAR, "authorig", 0


I need the .NET version
Something like:
Dim colarray() As Object = {0}
But this doesn't work!

In AD if you look in "Exchange General" > "Delivery Restrictions" > "Message Restrictions" There is a checkbox for 'authenticated users' and a radio button for 'From Everyone'. It's this radio button that I need enabled.


Thanks for your time
Stuart
 

stubar

Member
Joined
Nov 9, 2010
Messages
5
Programming Experience
1-3
I ask a question then find the answer myself!

Dim colarray() As Object = {}

This works.
Something must have jarred the subconcious in my last reply.
 

MattP

Well-known member
Joined
Feb 29, 2008
Messages
1,206
Location
WY, USA
Programming Experience
5-10
Hello
Thanks for the quick reply but that's the vbscript code
obj.PutEx ADS_PROPERTY_CLEAR, "authorig", 0

What I gave you was the VB.NET syntax that was equivalent to obj.PutEx ADS_PROPERTY_CLEAR, "authorig", 0. Notice the parenthesis.

If you need to declare an empty array of object you can use:

VB.NET:
Dim colarray(-1) As Object

Or

VB.NET:
Dim colarray() As Object = {}

Or the verbose version

VB.NET:
Dim colarray() As Object = New Object() {}
 
Top Bottom