0

ADAM でユーザー パスワードをリセットしようとしています。そのために、私は Accountmanagement 名前空間を使用しています

私が試したこと:

PrincipalContext rootPrincipalContext;
LdapConnection objLdapconnection;
rootPrincipalContext = new PrincipalContext(ContextType.ApplicationDirectory, host, baseDN, ContextOptions.Negotiate, username, password);
LdapDirectoryIdentifier identifier = new LdapDirectoryIdentifier(host, Convert.ToInt32(port));
NetworkCredential credential = new NetworkCredential(username, password);
LdapConnection ldapCon = new LdapConnection(identifier, credential);
ldapCon.AuthType = AuthType.Negotiate;
objLdapconnection = ldapCon;

パスワードのリセット:

 UserPrincipal existingUsr = UserPrincipal.FindByIdentity(rootPrincipalContext, IdentityType.DistinguishedName, "cn=" + inputName + ",ou=gslab,dc=starfish");

existingUsr.SetPassword(userPassvalue); this lines throws exception "directory property can not be found"

どの文字列も空でないことを確認し、contextOption.secureSocketlayer も試しましたが、何も機能しません

暗号化されたパスワードを提供する必要がありますか? または、プロパティを設定する必要がありますか? 前もって感謝します。

4

1 に答える 1

0

さて、私は解決策を得ました。取り除くだけ

ContextOptions.Negotiate 

インスタンス化中rootprincipalContext

ExpirePasswordNow()メソッドの前に使用しますSetPassword()

于 2013-09-02T11:06:21.993 に答える