Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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();

now..

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

Thanks alot for your responses

Tom

share|improve this question
    
_spUserId returned undefined –  Tom Kossmann Apr 12 '13 at 14:21

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer
    
Thanks for the response! Any further information why they did leave that useful variable out? –  Tom Kossmann Apr 12 '13 at 14:24
2  
They just moved the variable within the global context object. –  Vardhaman Deshpande Apr 12 '13 at 19:13

Your Answer

 
discard

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.