I am trying to update an attribute in active directory (e.g name). I got this error when I try to commit my changes. I tried changing the password for my login account and it worked fine. I just cant change the other attributes.
protectedvoid Page_Load(object sender, EventArgs e)
{
var ADService = newActiveDirectoryServiceTest();
DirectorySearcher mySearcher;
var entry = ADService.GetDirectoryEntry(ActiveDirectoryServiceTest.CompanyName.Whayne);
var listOfUser = ActiveDirectoryServiceTest.InitializeSearcher(ActiveDirectoryFiltersTest.GetFilterByUserName("Student01"), entry, out mySearcher);
mySearcher.SearchScope = SearchScope.Subtree;
mySearcher.CacheResults = false;
SearchResultCollection resultUsers = mySearcher.FindAll();
Dictionary<String, String> list = newDictionary<String, String>();
var user = resultUsers[0];
DirectoryEntry newDir;
foreach (string propName in user.Properties.PropertyNames)
{
ResultPropertyValueCollection valueCollection =
user.Properties[propName];
foreach (Object propertyValue in valueCollection)
{
if (!list.Keys.Contains(propName))
list.Add(propName, propertyValue.ToString());
}
}
newDir = user.GetDirectoryEntry();
var x = newDir.Path;
newDir.Username = @"Whayne.com\DWADMIN";
newDir.Password = @"DWadm2007";
newDir.AuthenticationType = AuthenticationTypes.Secure;
newDir.RefreshCache();
newDir.Properties["name"][0] = "TEST";
newDir.CommitChanges();
mySearcher.Dispose();
entry.Dispose();
GridView1.DataSource = list;
GridView1.DataBind();
}
}
amosCabanban...
Member
441 Points
142 Posts
The server is unwilling to process the request.
May 31, 2012 06:48 PM|LINK
I am trying to update an attribute in active directory (e.g name). I got this error when I try to commit my changes. I tried changing the password for my login account and it worked fine. I just cant change the other attributes.
amosCabanban...
Member
441 Points
142 Posts
Re: The server is unwilling to process the request.
May 31, 2012 07:21 PM|LINK
Found the answer.... The culprit is that Im using GC:\\ on my directory entry path instead of LDAP:\\