SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As we migrated our solutions and scripts from SP2010 to SP2013 my script ran into some weird error where I could not fetch the current logged in user with "_spUserId" anymore.

var user = _spUserId

As a workaround I'm using

user = currentWeb.get_currentUser();


Anyone with an Explanation? Is _spUserId obsolete in SP2013? Or is this some local problem?

Thanks alot for your responses


share|improve this question
_spUserId returned undefined – Tom Kossmann Apr 12 '13 at 14:21
up vote 9 down vote accepted

Yes _spUserId is deprecated in SP2013. Use _spPageContextInfo.userId instead.

share|improve this answer
They just moved the variable within the global context object. – Vardhaman Deshpande Apr 12 '13 at 19:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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