0

I am trying to add an Active Directory user to a group, and get "The server is unwilling to process the request." on CommitChanges(). I know I am binding to the directory OK and am finding both the groupDN path and userDN path, as I can return the GUID for each. Here is my code - if anyone can help me that would be fantastic! I have been hitting a brick wall over the last day trying to resolve this. Items enclosed in {} are where I replace an actual value with a generic one for posting here (i.e {domain} instead of posting our domain name).

string groupDn = "LDAP://CN={group name},OU=ApplicationGroups,DC={domain},DC={domain_dot_ext},DC={domain_dot_ext},";
 string userDn = @"LDAP://CN={lastname}\, {firstname},CN=Users,dc=scs,dc=sk,dc=ca";

dirEntry = new DirectoryEntry(groupDn, null, null, AuthenticationTypes.Secure);
dirEntry.Properties["member"].Add(userDn);
dirEntry.CommitChanges();
dirEntry.Close();

I have even gone so far as to pass my security credentials (I'm in Domain Admins) to make sure it's not a security credentials issue.

I'm missing something - but am at a loss. Hope someone out there can help.

Thx!

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by bart6961
0

I was having this same issue with the exact same block of code.

I replace your lines 5 and 6 with the following code and it worked perfectly.

dirEntry.Invoke("Add", New Object() {userDN})

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.