What is the easiest way to get the primary groupName from AD in C#?
- by madhatter84gn
I am currently using PrincipalContext and UserPrincipal to return the users primary groupid.
How can I take this id and find the actual group name?
Also I have code that works correctly to assign the user's primary group, but once I assign them to the group I can not delete them from Domain Users which is the default primary group prior to my change. I have called Save() before trying to remove the domain users group.
My requirements state I must add the user to AD then assign their primary group and then remove them as a member of Domain Users.