代码如下:
string newPassword = this.txtNewPwd;
string oldPassword = this.txtOldPwd
string userName = SPControl.GetContextWeb(Context).CurrentUser.LoginName;
userName = userName.Remove(0, userName.LastIndexOf('//') + 1);
DirectoryEntry user = new DirectoryEntry("WinNT://域名/主机名/" + userName,userName,oldPassword);
try
{
user.Invoke("ChangePassword", new object[]{oldPassword , newPassword});
user .close();
}
catch (Exception ex)
{
output.WriteLine("出错啦");
};