This project has moved and is read-only. For the latest updates, please go here.




Certified for SharePoint 2007 Certified for SharePoint 2010*


This utility function, which is also publicly available, returns information about the current user.

How It Works

The SPGetCurrentUser function does an AJAX call to grab /_layouts/userdisp.aspx?Force=True and "scrapes" the values from the page based on the internal field name (aka StaticName).

Note: There is a bug in the versions 2013.01, 2013.02, and 2014.01 where only the relative path ("/") is returned from $().SPServices.SPGetCurrentSite rather than the full path ("http://servername/sitename"). This causes problems in the root site for $().SPServices.SPGetCurrentUser.


  webURL: "",		// Added in 2013.01
fieldName: "Name",   fieldNames: {},      // Added in v0.7.2 to allow multiple columns
debug: false });

URL of the target Site Collection.  If not specified, the current Web is used.

You can specify which value from userdisp.aspx you'd like returned with this option. The default is the user's account (Name in the Field Internal Name column below). You can specify any of the Field Internal Names for option fieldName. The fields listed below are the default out-of-the-box fields. If you’ve got custom fields which are exposed on the userdisp.aspx page, then you should be able to retrieve them with this function as well.

Note that, as of v0.6.1, you can also request the ID of the user by specifying fieldName: "ID".

Field Name Field Internal Name WSS MOSS
Account Name
Name Title
Work e-mail EMail
About me Notes
Picture Picture
Department Department
Job Title JobTitle
SIP Address SipAddress
First name FirstName  
Last Name LastName  
Work phone WorkPhone  
Office Office  
User name UserName  
Web site WebSite  
Responsibilities SPResponsibility  

Added in v0.7.2 to allow requesting multiple column values. The column names can be passed in as an array, such as ["ID", "Last Name"]

Setting debug: true indicates that you would like to receive messages if anything obvious is wrong with the function call, like specifying a value which doesn't exist. I call this debug mode.


var thisUserAccount = $().SPServices.SPGetCurrentUser({
	fieldName: "Name",
	debug: false
var thisUserName = $().SPServices.SPGetCurrentUser({
	fieldName: "Title",
	debug: false
var thisUserID = $().SPServices.SPGetCurrentUser({
	fieldName: "ID",
	debug: false


var thisUsersValues = $().SPServices.SPGetCurrentUser({
	fieldNames: ["ID", "Name", "SIP Address"],
	debug: false

* Attested by Geoff Varosky

Last edited Oct 16, 2014 at 10:51 PM by sympmarc, version 21


xazzaxas Feb 23, 2016 at 4:31 PM 
f you are looking for info on how to get user id in SP Online and SP 2013, instead of using get current user try dumping the following object _spPageContextInfo. UserID attribute should contain what you need - along with any other data, without making an asynchronous request.

VipinTyagi Dec 23, 2015 at 11:38 AM 
Not getting department...

robertbarr Aug 14, 2015 at 9:17 PM 
does this return a deferred object?

xazzaxas Mar 13, 2015 at 9:42 PM 
using SPServices 2014.02 and jquery 1.11.1.min

usrFldNames = ["ID","Name","FirstName","LastName","EMail"],
cUsr = $().SPServices.SPGetCurrentUser({fieldNames: usrFldNames});

cUsr returns all data fine... with the exception of ID, which is undefined. What is going on? I've seen it mentioned that for older versions of SPS there was such an issue. I am surprised it's here still.

marmin Dec 16, 2014 at 2:22 PM 
I have use
var userName = $().SPServices.SPGetCurrentUser({
fieldNames: ["FirstName","LastName"]
For a user I haven't FirstName and LastName. Where I can see this information?

Farfalla_Fn Dec 8, 2014 at 2:00 PM 

So what should we do about the bug? I downloaded and used jquery.SPServices-2014.01BETA2 but the problem still exists.

Any ideas?


mvandeneijnde Jul 18, 2014 at 4:50 PM 
Hello Support,

We want to use this code and it works fine in IE but it seems not to work in Safari (haven't tried other browsers)

Please advise

Kind regards,

emfuentes27 Apr 1, 2014 at 7:28 PM 
For those that are asking how to get multiple column values. Just use:
var thisUsersValues = $().SPServices.SPGetCurrentUser({
fieldNames: ["Title", "EMail", "Office"],
debug: false

etc. etc

I hope it helps.

emfuentes27 Apr 1, 2014 at 4:52 PM 
This is a great tool, but I'm using:
var thisUsersValues = $().SPServices.SPGetCurrentUser({
fieldNames: ["ID", "Name", "SIP Address"],
debug: false

How can I get specific column value using this way? Thanks!

chloraphil Feb 21, 2014 at 3:08 AM 
FYI: This method is synchronous.

bjamesatwork Feb 19, 2014 at 3:55 PM 
The application pages need to be restricted on an external facing site. We don't want external users getting to anything under the Layouts folder. Especially aclinv.aspx

bjamesatwork Feb 19, 2014 at 3:53 PM 
I'm having problems using this due to a recent security restriction for the application pages. How can I get this information if the 'View Application Pages' permissions are not checked?

JSdream Dec 3, 2013 at 8:54 PM 
I am finding that this is not gettign the loginName of the user, if used at a subsite level. At the root level I get the loginName, at a subsite level I get nothing (empty loginName). I am using v0.7.2.

westerdaled Aug 14, 2013 at 8:20 AM 
A similar request to Zullu, is to be able to get and display profile info on a Master Page as a result of UPS sync with custom AD properties
var company = $().SPServices.SPGetCurrentUser({
fieldName: "Company",
debug: true

Although this is populated in user's profile the above variable is null

YYZRichard Apr 18, 2013 at 8:16 PM 
Perhaps in the next version, you could include an option to retrieve the SharePoint Groups that the user belongs to.

Lavanprax Apr 4, 2013 at 7:52 PM 
var thisUsersValues = $().SPServices.SPGetCurrentUser({
fieldNames: ["ID", "Name", "SIP Address"],
debug: false

How to get value from thisUsersValues

Zullu Dec 19, 2012 at 5:29 PM 
Couple of questions:
#1. How do we get the property "Office Location". I see that it has an internal name as [SPS-Location] in my User Profile.
#2. The above list of field names has ONLY 15 of them listed. Does it mean I cannot retrieve the others.
#3. I was wondering if the call $().SPServices.SPGetCurrentUser() pulls data directly from Active Directory or does it looks into the SP User Profiles?
I am using SP 2010 Enterprise.

marcocisi Dec 6, 2012 at 2:29 PM 
why dont expand this function to all the _layouts ? .... it would be great

praveenganga Oct 22, 2012 at 3:44 PM 
How to pass this variables to specified columns