Working with $expand and Lookup fields in SharePoint 2013?

While we get data from SharePoint list having Lookup Field column through REST API and AJAX call, I came across a situation that how to get Lookup field value as it was returning only Id. I tried many ways and here is the query to use in URL of REST call,

var URL = https://chaudhari3.sharepoint.com/sites/test_1/_api/Web/Lists/getByTitle(‘TestList’)/items?$select=*,CountryName/CountryName&$expand=CountryName/Id

where, CountryName is TestList’s Lookup column on Countries List’s CountryName SLT column.

Happy Coding 🙂

4 thoughts on “Working with $expand and Lookup fields in SharePoint 2013?”

      1. Marco Krechting

        HI,

        well I am having trouble getting data from two Lists.
        I have a list called OIE Alerts with a lookup field Country. It looks at a second List Countries with fields LandName and LandCode, holding respectively “Netherlands”, “NLD”.
        I need both LandName and LandCode from Countries.

        var urlForOrderBy = “/_api/Web/Lists/GetByTitle(‘OIE Alerts’)/Items?” +
        “$select=Title,Country,Date_of_Event,” +
        “$filter=Date_of_Event gt ” firstDay.toISOString() +
        ” and Date_of_Event lt + ” lastDay.toISOString() +
        “&$orderby=Date_of_Event desc”;

        something like this but I don’t think it will work 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top