I am trying to do code for ldap current user password change but I am getting a null value in PrincipleContext for the context, so the user principle errors out saying "bad user or password"
using (var context = new PrincipalContext(ContextType.Domain))
using (var user = UserPrincipal.FindByIdentity(
context,
IdentityType.SamAccountName,
Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.LoginName))
{
user.SetPassword(NewPwd);
}
Any help?
I want to basically change the current users password from a webpart.
Thanks