0

We are creating mobile app for SharePoint 2010 site.when mobile user enter user name and password .How i check that user exsists in AD or not .

1 Answer 1

0

You can use System.DirectoryServices.AccountManagement namespace, following should help:

// create a "principal context" - e.g. your domain (could be machine, too)
using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOURDOMAIN"))
{
    // validate the credentials
    bool isValid = pc.ValidateCredentials("myuser", "mypassword");
}

PS: It has nothing to do with SharePoint, but you can use it in SharePoint.. You might need to put the code in RunWithElevatedPrivileges

2
  • Thnx a lot Arsalan.
    – Jon
    Apr 4, 2014 at 10:27
  • @Jon if the above answer was helpful, please mark it correct with a Green tick available with the answer to close the Question.. Apr 4, 2014 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.