views:

1967

answers:

4

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.

A: 

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!

David A Gibson
A: 

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 ADSGROUPTYPEGLOBALGROUP As Object = &H2

Kev
A: 

Wee nitpicks are what I was after - thanks!

David A Gibson
A: 

Add reference to com dll ActiveDS DLl and import the namespace using ActiveDS;

then you will get the above enum value.

My query is that I ma able to create a group but the group is getting created as a security group and not as a distribution group. Can anybody plz help m eon this////

Varun

Varun Sharma