I'm using SPServices to query a SharePoint Online (2013) list that contains a Person or Group column. (This column is set to allow selection of People Only, in case that matters.)

The query used is below.

            <FieldRef Name='ComponentID'></FieldRef>
            <Value Type='Number'>151</Value>

    <FieldRef Name='RequiredApprovers' />
    // some other fields of other types

The response I get is below.

[userID = 6];#Skip Baker,[account = #i:0#.f|membership|[email protected]],#[email protected],#[email protected],#Skip Baker,#[Photo URL],#[Department Name],#[Job Title]

I want to parse the string into a User data object, which I know how to do. However, I don't know what all of the parts of the string are, and I don't want to rely on something being an email address when it's really a domain user name, etc. I've used brackets to indicate the parts I believe I understand. Can anyone tell me what the other parts of this string are?

  • Can you update the SPServices query you are using? It depends on what all information you are requesting. Apr 21, 2015 at 17:56
  • Happily - one sec :) Apr 21, 2015 at 18:04

1 Answer 1



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.

You don't need to manually parse data

function userToJsonObject(s) {
    if (s.length === 0) {
        return null;
    } else {
        var thisUser = s.split(";#"); 
        var thisUserExpanded = thisUser[1].split(",#")
        if(thisUserExpanded.length == 1) {
            return {userId: thisUser[0], userName: thisUser[1]}
        } else {
            return {
                userId: thisUser[0], 
                userName: thisUserExpanded[0].replace( /(,,)/g, ","), 
                loginName: thisUserExpanded[1].replace( /(,,)/g, ","), 
                email: thisUserExpanded[2].replace( /(,,)/g, ","), 
                sipAddress: thisUserExpanded[3].replace( /(,,)/g, ","), 
                title: thisUserExpanded[4].replace( /(,,)/g, ",")


  • That function doesn't actually return all the parts of the string I provided, so manual parsing is still required. However, I was able to find the unknown property names I was looking for inside the function. Thanks :) Apr 21, 2015 at 19:00

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.