سؤال

Can we get the lookup value from SharePoint list through REST without using the query operators (select/expand) ?

هل كانت مفيدة؟

المحلول

You can use the RenderListDataAsStream endpoint to fetch lookup values without using select or expand. This works for User fields as well as Managed metadata columns as well.

Try with the below sample code:

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + 
        "/_api/Web/Lists/GetByTitle('Documents')/RenderListDataAsStream",
    type: "POST",   
    headers: {
        Accept: "application/json;odata=nometadata",
        "Content-Type": "application/json;odata=nometadata",
        "X-RequestDigest": $("#__REQUESTDIGEST").val()
    },
    success:function(data){
        // iterate over data.Row
        console.log(data.Row);
    },
    error:function(data){
        console.log(data);
    }
});

Reference - Working with list items by using REST

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top