How can I get Userid of a user based on his account name or email using SPServices

I checked here https://stackoverflow.com/questions/5542208/sharepoint-2010-use-spservices-to-get-a-users-id

but this is getting current user id I want to get userid of any user based on there account names.


For SharePoint 2010, you could use JSOM to load the user and retrieve user id by user.get_id()

ExecuteOrDelayUntilScriptLoaded(CustomFun, "sp.js");
        function CustomFun() {            
            var context = SP.ClientContext.get_current();
            var newUser = context.get_web().ensureUser("contoso\\usera");
            function(sender, args){

From SharePoint 2013, I would suggest you use REST api https://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html

  • I have SharePoint 2010 – Mehdi Jalal Oct 3 '18 at 6:04
  • 1
    Above script is tested in my local SharePoint 2010. – Lee_MSFT Oct 3 '18 at 7:17
  • Nice worked for me – Mehdi Jalal Oct 3 '18 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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