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
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
-
-
@Jon if the above answer was helpful, please mark it correct with a Green tick available with the answer to close the Question.. Commented Apr 4, 2014 at 10:44