David A Gibson
David A Gibson

Reputation: 2033

Setting Group Type for new Active Directory Entry in VB.NET

I'm trying to set the group type for a new Active Directory Entry via VB.NET and DirectoryServices to create a distribution list.

How do I access the ADS_GROUP_TYPE enumerations?

Specifically I'm after ADS_GROUP_TYPE_GLOBAL_GROUP.

Upvotes: 3

Views: 4189

Answers (3)

Varun Sharma
Varun Sharma

Reputation: 11

Add a reference to the com ActiveDS Dll and import the namespace using ActiveDS, then you will get the above enum value.

Upvotes: 1

David A Gibson
David A Gibson

Reputation: 2033

I don't think I can access the enumerations via .NET so instead I created the specific constant I needed. For what it's worth here's my code:

        Const ADS_GROUP_TYPE_GLOBAL_GROUP As Object = &H2
        adNewGroup.Properties("groupType").Value = ADS_GROUP_TYPE_GLOBAL_GROUP

Refactoring welcome!

Upvotes: 0

Kev
Kev

Reputation: 119846

You're correct, you can't actually get access to the enumerations.

Just a wee nitpick, this constant doesn't need to be an object, you can make it an int32 -

Const ADS_GROUP_TYPE_GLOBAL_GROUP As Object = &H2

Upvotes: 0

Related Questions