Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.