Thursday, August 6, 2009

Change a users property in Active Directory

In order to change a users property you must get the DirectoryEntry for the user. Below are some simple code that I have been using in my “AD import Tool”

GetUser – Returns a DirectoryEntry that can be used to get and set properties for a user object i AD (Click for a larger image, code is at the end of the post)

GetUser Example

The function used in a wrapper class along with other code mainly gathered in the Howto: (Almost) Everything In Active Directory via C# at CodeProject.

 

ADHelper GetUser Example

You can download the ADHelper class here

Note: This is a only a simple example. It has not been tested thoroughly for memory leaks.

No comments: