1

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

1
  • 1
    Well you can use CAML query instead of the select/expand option, I can't see why you would want to do it though?
    – Morten K
    Commented Sep 19, 2018 at 10:45

1 Answer 1

2

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

5
  • Thank you for quick response. But it is giving error while using with 'GET' method . I need get values. Commented Sep 20, 2018 at 5:02
  • It is a POST method, can you check with the snippet i posted here ? It is not a GET request Commented Sep 20, 2018 at 5:05
  • Yeah. It works . Thanks for your response. If possible please suggest best reference for "RenderListDataAsStream" explaining where to use and how can we use that. In official document it directly used without explanation. Commented Sep 20, 2018 at 5:12
  • Cheers, happy to help. You can accept this answer by ticking the checkmark besides the answer ! It will remove it from the list of unanswered questions. Thanks. Additionally, you can refer this and this link which are blogs. Commented Sep 20, 2018 at 5:17
  • @GautamSheth, RenderListDataAsStream method handles the list threshold error? I am trying to get the items from list more than 5K. Even after I apply filter query is giving exception: -2147024860, Microsoft.SharePoint.SPQueryThrottledException. Will this method solve this issue?
    – Mihir
    Commented Sep 30, 2020 at 11:28

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.