C# Change Properties Active Directory AD


//Username Password Administrator
DirectoryEntry directionEntry =
new DirectoryEntry(ldapPath, "yourdomain.com\\" + "Administrator", "password");
if (directionEntry != null)
{
DirectorySearcher search = new DirectorySearcher(directionEntry);
//Account yang ingin diganti propertiesnya
search.Filter = "(SAMAccountName=" + "ricky.namara" + ")";
SearchResult result = search.FindOne();
if (result != null)
{
DirectoryEntry userEntry = result.GetDirectoryEntry();
if (userEntry != null)
{

userEntry.Properties["mail"].Value = "ricky.namara@pln-enjiniring.com";
userEntry.CommitChanges();

}
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: