DirectoryEntry.Rename(String newName) : DirectoryEntry « System.DirectoryServices « C# / C Sharp by API






DirectoryEntry.Rename(String newName)

  


using System;
using System.DirectoryServices;

class MainClass
{
   public static void Main()
   {
      DirectoryEntry de = new DirectoryEntry(
        "LDAP://192.168.1.100/ou=auditing, ou=accounting, dc=ispnet1, dc=net",
        "cn=Administrator, dc=ispnet1, dc=net", "password",
        AuthenticationTypes.ServerBind);

      DirectoryEntries des = de.Children;
      DirectoryEntry badObject = des.Find("cn=test");
      badObject.Rename("cn=newName");
      de.CommitChanges();
      de.Close();
   }
}

   
    
  








Related examples in the same category

1.new DirectoryEntry()
2.new DirectoryEntry(String connection)
3.DirectoryEntry.Children
4.DirectoryEntry.Close()
5.DirectoryEntry.CommitChanges()
6.DirectoryEntry.DeleteTree()
7.DirectoryEntry.Password
8.DirectoryEntry.Path
9.DirectoryEntry.Properties
10.DirectoryEntry.Username