Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 INSERT INTO AD?

Author  Topic 

jhermiz

3564 Posts

Posted - 2007-01-16 : 08:53:36
Im able to pull data from Active Directory using LDAP queries.
Anyone know how to actually INSERT data into active directory ?
For instance, I am wanting to create a winform either in vb.net or C# to insert / update / delete users from active directory.

I've never pushed data to AD, so any examples would be helpful.




Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]

jhermiz

3564 Posts

Posted - 2007-01-16 : 09:48:02
I found some sample code however it keeps throwing an unknown error :|


private void Form1_Load(object sender, EventArgs e)
{
try
{

DirectoryEntry parent = new DirectoryEntry("<LDAP://jakah-2k3-dc-1.jakah.com/DC=jakah,DC=com", null, null, AuthenticationTypes.Secure);

DirectoryEntry user = parent.Children.Add("CN=test.user", "user");

using (user)
{
user.Properties["sAMAccountName"].Value = "test.user";
user.CommitChanges();
}
}
catch(Exception e1)
{
throw e1;
}
}


Not sure if I need a CN ? I read this http://www.jonathanmalek.com/blog/ADAMASPNETCAndUnknownError0x80005000KeepingAStiffUpperLip.aspx

But cant seem to figure out what I would need to change...



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page
   

- Advertisement -