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!

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})
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.