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)
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.
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:
Post a Comment