Modifying Existing Object Attributes : Modify : Directory Services C# Examples


C# Examples » Directory Services » Modify »

 

Modifying Existing Object Attributes









    
using  System;
using  System.DirectoryServices;

public  class  MainClass
{
    public  static  int  Main(string[]  args)
    {
        DirectoryEntry  MyDirectoryObject  =  new  DirectoryEntry();
        
        MyDirectoryObject.Path  =  "LDAP://HMSRevenge/CN=Greg  MacBeth,OU=users,DC=Test,DC=com";
        MyDirectoryObject.Username  =  @"Test\tttt";
        MyDirectoryObject.Password  =  @"MyPassword";

        if(MyDirectoryObject.Properties[("company")].Value  ==  "Old  Company  Name.  inc.")
        {
            MyDirectoryObject.Properties[("company")][0]  =  "new  name";
        }

        MyDirectoryObject.CommitChanges();

        return  0;
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Directory Services
» Modify