Add/Remove group memberships

Mar 18, 2014 at 5:30 AM
First of all, thanks sbaker for the great library. How would one go about adding a user to a group and removing a user from a group? I expected something like:
MyDirectoryContext ct = new MyDirectoryContext();
User usr = ct.Users.Where(i=>i.UserName == "sbaker").FirstOrDefault();
ct.Groups.First().Users.Add(usr);
ct.SubmitChanges();
but there is are no Add or Remove methods on an EntryCollection<>.

Thanks,

Sam
Coordinator
Mar 18, 2014 at 6:46 PM
Hi sammie_p

The functionality adding a user to a group is in the codebase. See: GroupEntryObject.cs

It just hasn't been added to a release just yet. If you'd like this functionality now, you can download the source and build it and use those binaries. Note: it may not be as stable as the released bits.

Thanks,
Stephen Baker
Marked as answer by sammie_p on 3/18/2014 at 4:18 PM
Mar 18, 2014 at 11:18 PM
Hi Stephen,

I have downloaded the source and changed my group class from inheriting EntryObject to inheriting GroupEntryObject. All seems to be working well.

Thanks again,
Sam