0
Answer

C# How to Move a User from a Organization unit to another OU

Andreaw T

Andreaw T

16y
8.4k
1

Hi,

i'm trying to move an AD User from a OU to another OU in C#

This doesn't work...

public void AddToOU(string User, string OU)

{

DirectoryEntry ent = new DirectoryEntry("LDAP://DC=" + DC);

DirectoryEntry ou = ent.Children.Find("OU=" + OU);

DirectoryEntry group = ou.Children..Add("CN=" + User, "user");

group.CommitChanges();

}

 

Thank's