Hello:

I am design a tool that can connect to active directory.

I make a AD_operation class, in the class I write some method, here is a
function that i write as the following:

                /// <summary>
                /// check if the OU,Group or User exist
                /// </summary>
                /// 
                /// 
                /// <returns></returns>
                public bool ObjectExists(string objectName, string catalog)
                {
                        DirectoryEntry de = 
Connect_Domain.AdHelper.GetDirectoryEntry ();
                        DirectorySearcher deSearch = new DirectorySearcher();
                        deSearch.SearchRoot = de;
                        switch (catalog)
                        {
                        case "User": deSearch.Filter = "(&(objectClass=user) 
(cn=" + objectName +
"))"; break;
                        case "Group": deSearch.Filter = "(&(objectClass=group) 
(cn=" + objectName
+ "))"; break;
                        case "OU": deSearch.Filter = 
"(&(objectClass=OrganizationalUnit) (OU=" +
objectName + "))"; break;
                        default: break;
                        }
                        SearchResultCollection results = deSearch.FindAll();
                        if (results.Count == 0)
                        {
                                return false;
                        }
                        else
                        {
                                return true;
                        }
                }

the function is check the active directory all the object, if find it,
record it

but when the program run it, it throws a exception at  line: 
SearchResultCollection results = deSearch.FindAll();

the exception is Novell.Directory.Ldap.LdapException has been thrown.

i don't know why, is there anyone can help me?


Novell.Directory.Ldap.LdapException has been thrown



--
View this message in context: 
http://mono.1490590.n4.nabble.com/Novell-Directory-Ldap-LdapException-has-been-thrown-tp4670200.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.dot.net/mailman/listinfo/gtk-sharp-list

Reply via email to