1

I'm trying to put a new Active Directory user in a new Active Directory group. Normally you can do something like this:

DirectoryEntry groupEntry = ......;
groupEntry.Properties["member"].Add(userEntry);
groupEntry.CommitChanges();

Now the problem is that a new AD group does not have the "member" property; the above code will therefore throw you an exception. When you manually add a user to a group in Active Directory, the "member" property will be created automatically. But there is no way I can create the "member" property in code; the Properties property is read-only and also an InvokeSet("member", new List()) or something similar throws me an exception.

Can anyone give me a hint on how to create a non-existing property for an AD entry?

PS: as the user is also new, he doesn't have the "memberOf" property: this will generate the exact same problem.

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
user825887
  • 219
  • 2
  • 9

0 Answers0