1

I want to get Document Kind filed title, but with following request I am getting only these data:

<SITE_URL>/_api/web/lists/GetByTitle('<DOCUMENT_LIBRARY_NAME>')/items()?$select=Document_x0020_Kind

Image

I receive same response if I use:

..../items()?ListItemAllFields

I need a normal Label, not Id in Label. Can someone help?

  • Is this column created by you? – harshal gite May 29 '17 at 8:53
0

There are 3 options :

Option 1 - if the document library is at the site collection level, you can use the below endpoint with a GET call.

/_api/web/Lists/GetByTitle('<DOCUMENT_LIBRARY_NAME>')/items?$select=Title,TaxCatchAll/Term&$expand=TaxCatchAll

Option 2 - If you know the ID of the list item, then you can use the below endpoint with a GET call.

<SITE_URL>/_api/web/lists/GetByTitle('<DOCUMENT_LIBRARY_NAME>')/items(1)/FieldValuesAsText

Option 3 - you can use the below POST method if the document library is at the subsite level.

$.ajax({
    url: "https://Site_url/_api/web/Lists/GetByTitle('<DOCUMENT_LIBRARY_NAME>')/GetItems(query=@v1)?@v1={'ViewXml':'<View><Query></Query></View>'}",
    type: "POST",
    headers: {
        "Accept": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val()
    },
    success: function (data, textStatus, jqXHR) {
        for (var i = 0; i < data.d.results.length; i++) 
        {
              if(data.d.results[i].Document_x0020_Kind != null)
              {
                    console.log(data.d.results[i].Document_x0020_Kind.Label);
              }
        }
    },
    error: function (jqXHR, textStatus, errorThrown) {
        console.log('error')
    }
});

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.