Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

Phagu Mahato
More...


Resources » Code Snippets » Active Directory

Create New User Programmatically in Active Directory


Posted Date:     Category: Active Directory    
Author: Member Level: Gold    Points: 10



 


This code shows how to create a new user in AD


public static DirectoryEntry CreateNewUser(string cn)
{
//set the LDAP qualification so that the user will be created under the Users
//container

string LDAPDomain ="/CN=Users," + GetLDAPDomain();
DirectoryEntry oDE= GetDirectoryObject(LDAPDomain);
DirectoryEntry user = oDE.Children.Add("CN=" + cn, "user");

//Must commit changes to initially create user

user.CommitChanges();

oDE.Close();
oDE.Dispose();

return user;

}





Did you like this resource? Share it with your friends and show your love!


Responses to "Create New User Programmatically in Active Directory"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Authenticate User By Active Directory using LDAP
    Previous Resource: Active Directory
    Return to Resources
    Post New Resource
    Category: Active Directory


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Active Directory  .  New user  .  Using  .  Creation  .  API  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.