I'm using SharePoint 2013 on premises and I want to get the Id of a user to later change the Author of a listitem. I've used this url "/_api/web/siteusers(@v)?@v='{1}", but the id I get for my user is 15 and I know that my user id is 9, What am I doing bad?

  • do you want to get user by it's login name? – Atish Dipongkor - MVP Sep 25 '16 at 12:22
  • I only want the Id of the user by it's login name, then with that Id I would change the author id of an item list – Luis Molina Sep 26 '16 at 6:35

There is one more way to get ID of current logged user using "_spPageContextInfo" object.

Please refer following code -->


Reference - Understanding the _spPageContextInfo object

| improve this answer | |
  • This will not work outside of a SharePoint page – Jigar Sep 25 '16 at 11:21
  • Yes Jigar, you are right, this object is available only on SharePoint pages. – Rohit Waghela Sep 25 '16 at 12:01
  • Yes, that is not what I need, anyway thanks Rohit. – Luis Molina Sep 26 '16 at 6:36

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.