I'm trying to add a user to the group, but I get the following error:
Message: The server is reluctant to process the request. ErrorCode: -2147016651
ExtendedError: 1359
ExtendedErrorMessage: 0000054F: SvcErr: DSID-031A120C, Problem 5003 (WILL_NOT_PERFORM), Date 0
HResult: -2147016651
I get this with the following code:
public void UpdateUserGroup(ADEntry selectedEntry, ADEntry groupEntry, bool addUser)
{
DirectoryEntry selectedDirEntry = selectedEntry.ToDirectoryEntry(this.Connector.Credential);
DirectoryEntry groupDirEntry = groupEntry.ToDirectoryEntry(this.Connector.Credential);
if ((selectedDirEntry.SchemaClassName.Equals("user")) && (groupDirEntry.SchemaClassName.Equals("group")))
{
if (addUser)
{
groupDirEntry.Properties["member"].Add(selectedDirEntry.Path);
}
else
{
groupDirEntry.Properties["member"].Remove(selectedDirEntry.Path);
}
groupDirEntry.CommitChanges();
groupDirEntry.RefreshCache();
}
}
The user I am using is DomainAdmin. Anyone have any suggestions for solution?
Thank you.