0

I am building a JavaScript web part that queries a SharePoint list and generates a report based on the list data. I want to be able to get the user ID for a given user by their name or email.

input - User Name: "jdoe" output - User ID: 12

Can this be accomplished using JavaScript? If so, can anyone provide a link to where I can read about how to do so?

Thank you

1
  • Are you trying to retrieve the SharePoint User ID or the value in the User ID column of your list?
    – AtariPixel
    Mar 23, 2020 at 9:31

1 Answer 1

0

We can get user ID by the login name - using the below REST API query :

http://<site url>/_api/web/sitegroups(<group id>)/users(@v)?@v='<login name>'

http://<site url>/_api/web/siteusers(@v)?@v='<login name>'

Similar question is discussed here :

How To Get User Id Using Login Name in Share Point Provider Hosted App

1
  • Thanks for pointing me in the right direction!
    – fce_sp
    Mar 24, 2020 at 11:25

Your Answer

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

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