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

I am new to SPServices, I am trying to fetch list items from a list.

I am fetching the Title and a person field(Created By).

When i print the Created By field ,I get the person name say XYZ.

But i want to get his ID i.e DOMAIN\NO.

How can i achieve this? This is my code:

        operation: "GetListItems",
        async: false,
        listName: "AppreciationList",
        CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Appreciated_x0020_Person'/><FieldRef Name='Author'/></ViewFields>",
        completefunc: function (xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function () {

                alert($(this).attr("ows_Appreciated_x0020_Person")+ $(this).attr("ows_Title"));


share|improve this question

In order to return account name, email, and name instead of just the name, use:

CAMLQueryOptions: "<QueryOptions><ExpandUserField>True</ExpandUserField></QueryOptions>"

Refer SPServices GetListItems documentation for more details.


        operation: "GetListItems",
        async: false,
        listName: "Tasks",
        CAMLQueryOptions: "<QueryOptions><ExpandUserField>True</ExpandUserField></QueryOptions>",
        CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='AssignedTo'/></ViewFields>",
        completefunc: function (xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function () {

About ExpandUserField property

According to MSDN:

Gets or sets a Boolean value that specifies whether to use special rendering for user field values that makes them include the login name, e-mail address, Session Initiation Protocol (SIP) address, and title, when present, which causes a user field to behave as a multilookup field.


$().SPServices.SPXmlToJson function includes support for converting user properties into JSON, for more details follow this discussion.

Example: how to convert response into JSON for User field:

 var result = $(xData.responseXML).SPFilterNode("z:row").SPXmlToJson({
         mapping: { 
             ows_AssignedTo: { mappedName: "AssignedTo", objectType: "User"}  
         includeAllAttrs: true
share|improve this answer
Let me add: The return data from this expanded User field will include all the data above but it will be parsed as it is returned as a single string. I forget now what the delimeter is. – Paul T. Mar 12 '14 at 13:11
Paul, thanks for your comment, the answer has been updated. – Vadim Gremyachev Mar 12 '14 at 15:57

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.