This project is read-only.

Move Entry

Moving an entry is done by using a ModifyDN operation. Because the distinguished name is the unique identifier for an entry in the directory, it cannot be updated like a normal attribute. This operation will affect any entries below it as well. An error will occur if you try to move an entry to a location that is not a container.
Move a Single Entry
string currentDn = "CN=Test User,CN=Users,DC=example,DC=com";

string newLocation = "CN=Test Users,DC=example,DC=com";

string newDn = context.MoveEntry(currentDn, newLocation);
// newDn equals "CN=Test User,CN=Test Users,DC=example,DC=com"

User user = context.GetByDN<User>(newDn);
Move a Container
string currentDn = "CN=Test Users,DC=example,DC=com";

string newLocation = "CN=Users,DC=example,DC=com";

string newDn = context.MoveEntry(currentDn, newLocation);
// newDn equals "CN=Test Users,CN=Users,DC=example,DC=com"

List<User> users = context.Query<User>(namingContext: newDn).ToList();

Last edited Jun 17, 2012 at 7:24 AM by MadHatter22, version 1