現在、ここにはいくつかの方法があります。
public ADHelper()
{
connection = InitializeConnection();
}
private DirectoryEntry InitializeConnection()
{
DirectoryEntry ldapConnection = new DirectoryEntry("LDAP://servername.domain.com:389/DC=domain,DC=com");
ldapConnection.Username = "user"
ldapConnection.Password = "password";
ldapConnection.AuthenticationType = AuthenticationTypes.Secure;
return ldapConnection;
}
そのドメイン内にオブジェクトが存在するかどうかを確認する別のメソッドを作成したいと思います。私は現在、次のことを行っています。
public bool Exists(string objectPath)
{
bool found = DirectoryEntry.Exists("LDAP://" + objectPath);
return found;
}
しかし、それでは LDAP 文字列全体を指定する必要があります。Exists() メソッド内の OU とおそらく CN パラメータを使用して、最初の ldapConnection を単純に拡張したいと思います。Initialize() メソッドを公開せずにこれを実現する方法はありますか?
本当にありがとう!