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


  • _spUserId returned undefined
    – t0.
    Apr 12 '13 at 14:21

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

  • 3
    They just moved the variable within the global context object. Apr 12 '13 at 19:13

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.