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 Kumar DipongkorCommented Sep 25, 2016 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 MolinaCommented Sep 26, 2016 at 6:35
Add a comment
|
1 Answer
There is one more way to get ID of current logged user using "_spPageContextInfo" object.
Please refer following code -->
_spPageContextInfo.userId
Reference - Understanding the _spPageContextInfo object
-
-
Yes Jigar, you are right, this object is available only on SharePoint pages. Commented Sep 25, 2016 at 12:01
-