1

Am trying to get the Person or Group field(approver) value using REST API in SharePoint2010. am able to get the account details but i need the display name of the Approver. here is the my code

        $.ajax  
    ({ url: siteURL+ "/_vti_bin/ListData.svc/"+ listName +"("+ietmID+")?$select=Name,Approver/Account&$expand=Approver",// list item ID 
         method: "GET",
         headers: { "Accept": "application/json; odata=verbose" },
         success: function (data)
          {

        var listiteminfo= data.d;  

            var approvers="";
        var approverLenght=listiteminfo.Approver.results;
        //alert(approverLenght.length);
        for (var j = 0; j < approverLenght.length; j++) {
        alert(approverLenght[j].Account);

        }       


             //success(data.d);
          },
        error: function (data)
        {
        alert('error');
       // failure(data.responseJSON.error);
        } 
});
  • Hi how you authenticate this url in 2010.. any reference please .. – Subha Jul 17 '17 at 15:38
0

Hi please try with below endpoint

/_vti_bin/ListData.svc/"+ listName +"("+ietmID+")?$select=Name,Approver/Account,Approver/Name,Approver/UserName&$expand=Approver"

Hope it helps you and can find user properties below link to refer

<m:properties>
<d:ContentTypeID>0x010....</d:ContentTypeID>
<d:Name>Doe, John</d:Name>
<d:Account>ABC\john.doe</d:Account>
<d:WorkEMail>jd@abc.com</d:WorkEMail>
<d:MobilePhone m:null="true" />
<d:AboutMe m:null="true" />
<d:SIPAddress m:null="true" />
<d:IsSiteAdmin m:type="Edm.Boolean">false</d:IsSiteAdmin>
<d:Deleted m:type="Edm.Boolean">false</d:Deleted>
<d:Picture m:null="true" />
<d:Department m:null="true" />
<d:Title m:null="true" />
<d:FirstName>John</d:FirstName>
<d:LastName>Doe</d:LastName>
<d:UserName>John.Doe</d:UserName>
<d:WebSite m:null="true" />
<d:AskMeAbout m:null="true" />
<d:WorkPhone>8885551212</d:WorkPhone>
<d:Office m:null="true" />
<d:Unit m:null="true" />
<d:Id m:type="Edm.Int32">2</d:Id>
<d:ContentType>Person</d:ContentType>
<d:Modified m:type="Edm.DateTime">2016-09-27T00:00:19</d:Modified>
<d:Created m:type="Edm.DateTime">2013-10-17T12:13:59</d:Created>
<d:CreatedById m:type="Edm.Int32">3</d:CreatedById>
<d:ModifiedById m:type="Edm.Int32">1073741823</d:ModifiedById>
<d:Owshiddenversion m:type="Edm.Int32">217</d:Owshiddenversion>
<d:Version>1.0</d:Version>
<d:Path>/sites/test/_catalogs/users</d:Path>
</m:properties>

`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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