In Sharepoint 2010 I am getting display name of the user with SPServices like 11;#John, Kondo. But I want account name like mydomain\aa2311. Is there any way to get the account name with the display name property? Not for the currently logged in user. I am having one person or group column in sharepoint list. I am getting values from this column. It is giving like 11;#John Kondo Following is the code :

 var getListItemsFrom= function(listName, viewFields, queryText, rowCount, queryOptions, asyncBool){
            var deferred = $.Deferred();
                    async: asyncBool,
            return deferred;
getListItemsFrom("Demand Requests",viewFields ,query,0,"",true).then(function(data){
       var requestorAccountIds = $(this).attr('ows_Requestor');//ows_Requestor is person or group field


1 Answer 1


You can expand the user field using following code

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

Now you can extract username in success method by using string manipulation.

  • Not for the current user.
    – Mihir
    Apr 14, 2015 at 14:53
  • Updated with code.
    – Mihir
    Apr 14, 2015 at 15:00
  • This is giving me strange result like 11;#John,, Kondo,#i:0#.w|abl\ab14431,#[email protected],#[email protected],#John,, Kondo. It is having two commas between user display name. Do you know why?
    – Mihir
    Apr 14, 2015 at 15:13
  • It might be user middle name.. You can split this result usin | and then take the second part. Split it by comma and take first part.. tat will give you abl\ab14431 Apr 14, 2015 at 15:16
  • Yeah this is fine. But if you observe display name like11;#John,,Kondo giving two commas. You meant to say this is happening because of middle name is empty?
    – Mihir
    Apr 14, 2015 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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