0

I am trying to get the current user GUID (not the Id, an integer). Making a call to

http://servername/_api/web/CurrentUser/

which would would give the Id which can in turn be used to make a call

http://contoso/_api/Web/GetUserById(1)/

to get other properties such as login name, email etc., but does not return the Guid of the user. The guid is used to compare the owner id guids on other records in the logic. The deployment is an on-prem deployment.

Any answers/suggestions/pointers in the right direction would be highly appreciated.

1 Answer 1

1

Try

/_api/web/SiteUserInfoList/Items/?$filter=Id eq 1
4
  • Looks like I am getting a different Id for the current user when I am logged in as a different user, I am using window._spPageContextInfo.userId to get the current user id, which in turn is causing a different GUID to be returned. Jan 22, 2016 at 18:29
  • I don't understand your comment. Can you explain a little more. Jan 22, 2016 at 18:41
  • to re-phrase my question, all I am trying to get is the Current Users Guid, so as starting point, I am getting the Id of the current user by getting the value of _spPageContextInfo.userId. This in-turn would be used by the REST query, as an example, if John Doe is logged in, I would get lets say 1 as the users Id when logged in as somebody other than john doe and 34 as the Id when logged in as John doe, the user itself which in turn is causing different guids to be returned because now the filter on the rest query is referencing different Ids when logged in as different users for the same user Jan 22, 2016 at 19:03
  • What do you mean by "when logged in as different users for the same user" Jan 22, 2016 at 19:31

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.