GetSchemaDN() public method

Retrieves the Distiguished Name (DN) for the schema advertised in the root DSE of the Directory Server. The DN can be used with the methods fetchSchema and modify to retreive and extend schema definitions. The schema entry is located by reading subschemaSubentry attribute of the root DSE. This is equivalent to calling {@link #getSchemaDN(String) } with the DN parameter as an empty string: getSchemaDN("").
LDAPException This exception occurs if the schema DN /// cannot be retrieved, or if the subschemaSubentry attribute associated /// with the root DSE contains multiple values. /// ///
public GetSchemaDN ( ) : System.String
return System.String
 static void Main(string[] args)
 {
     if ( args.Length != 6)
     {
         Console.WriteLine("Usage:   mono GetAttributeSchema <host name> <ldap port>  <login dn>" + " <password> <search base>" + " <search filter>");
         Console.WriteLine("Example: mono GetAttributeSchema Acme.com 389"  + " \"cn=admin,o=Acme\"" + " secret \"ou=sales,o=Acme\"" + "         \"(objectclass=*)\"");
         return;
     }
     string ldapHost = args[0];
     int ldapPort = System.Convert.ToInt32(args[1]);
     String loginDN  = args[2];
     String password = args[3];
     String searchBase = args[4];
     String searchFilter = args[5];
     try
     {
         LdapConnection conn= new LdapConnection();
         Console.WriteLine("Connecting to:" + ldapHost);
         conn.Connect(ldapHost,ldapPort);
         conn.Bind(loginDN,password);
         LdapSchema dirschema=conn.FetchSchema(conn.GetSchemaDN());
         LdapSearchResults lsc=conn.Search(  searchBase,
             LdapConnection.SCOPE_ONE,
             searchFilter,
             null,
             false);
         while (lsc.hasMore())
         {
             LdapEntry nextEntry = null;
             try
             {
                 nextEntry = lsc.next();
             }
             catch(LdapException e)
             {
                 Console.WriteLine("Error: " + e.LdapErrorMessage);
                 // Exception is thrown, go for next entry
                 continue;
             }
             Console.WriteLine("\n\n\n");
             Console.WriteLine("\n" + nextEntry.DN);
             LdapAttributeSet attributeSet = nextEntry.getAttributeSet();
             System.Collections.IEnumerator ienum=attributeSet.GetEnumerator();
             while(ienum.MoveNext())
             {
                 LdapAttribute attribute=(LdapAttribute)ienum.Current;
                 string attributeName = attribute.Name;
                 Console.WriteLine(  attributeName + ":  " + dirschema.getAttributeSchema(attributeName).ToString());
             }
         }
         conn.Disconnect();
     }
     catch(LdapException e)
     {
         Console.WriteLine("Error:" + e.LdapErrorMessage);
         return;
     }
     catch(Exception e)
     {
         Console.WriteLine("Error:" + e.Message);
         return;
     }
 }