I am trying below code but unable to read name from Custodian column value which is people picker, it always show me id

                url: `${reactHandler.props.siteurl}/`+_options[i].key+`/_api/web/Lists/GetByTitle('Documents')/GetItems(query=@v1)?@v1={'ViewXml':'<View><ViewFields><FieldRef Name=\"Title\"/><FieldRef Name=\"Date\"/><FieldRef Name=\"Business\"/><FieldRef Name=\"Number\"/><FieldRef Name=\"Business\"/><FieldRef Name=\"Custodian\"/></ViewFields><Query><Where><And><Neq><FieldRef Name=\"_IsRecord\"/><Value Type=\"Computed\">0</Value></Neq><IsNotNull><FieldRef Name=\"_IsRecord\" /></IsNotNull></And></Where></Query></View>'}`,
                type: "POST",
                headers: {
                    "Accept": "application/json;odata=verbose",
                    "Content-Type": "application/json;odata=verbose",  
                    "X-RequestDigest": data.d.GetContextWebInformation.FormDigestValue,
                    "X-HTTP-Method": "POST"
                    //"X-RequestDigest": jquery("#__REQUESTDIGEST").val()
            success: function(data) {
              if (data.d.results.length > 0) { 
            for (var i = 0; i < data.d.results.length; i++) {
                            var odata = data.d.results[i];
                              key: odata.ID,
                              name: odata.Number ,
                              value: odata.ID,
                              iconName: odata.ID,
                              fileType: odata.ID,
                              modifiedBy: odata.Title,
                              dateModified: odata.Date.split('T')[0],
                              dateModifiedValue: odata.Business.Label,
                              fileSize: odata.Business.Label,
                              fileSizeRaw: odata.Business.Label,

You could use $expand in rest api to get user name.


Similar issue:


Updated: enter image description here

My test caml for your reference:

               <Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>27</Value></Eq></Where> 
             <ViewFields><FieldRef Name='people' /><FieldRef Name='managed' /></ViewFields> 
  • i am using caml to extract label from managed metadata column , if i do rest call managed metadata column is showing ID – kumar Aug 17 '20 at 3:33
  • As I test, I can get the manged metadata label. – Amos Aug 18 '20 at 3:17
  • my managed metadata column is single value selection in rest call its coming as ID , in camll i am able to get as Label but unable to expand People picker in caml query – kumar Aug 18 '20 at 11:20
  • i want to expand people picker in caml is this possible ? – kumar Aug 18 '20 at 11:21
  • I do not find a way to expand people column in rest caml. – Amos Aug 19 '20 at 8:03

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.