In my previous posts I have discussed how to read from the Active Directory(AD). Here I talk about how to update a record in the AD.
First you need to establish the connectivity with the AD same as the way I have explained in one of my previous posts.
Using below method I pass the 'testname' which is the username. Inside the method I go through all the AD users to compare whether the 'testname' and 'samaccountnames' are similar.
In the below method I check whether titles are matching for the AD user passed from above method, if not new 'position' is assigned to user principal description.
To save the changes you need to use below command.
public void SaveADRecords(UserPrincipal prinUser)
{
prinUser.Save();
}
No comments:
Post a Comment