Unable to fetch lookup field values using REST api
-
08-02-2021 - |
Question
I am using REST api to fetch data from a SharePoint list.
I am able to get data using this query:
requestUri = "/_api/lists/GetByTitle('Data')/items?$select=ID,Title,Department/Title&$expand=Department
However when I use this query:
requestUri = "/_api/lists/GetByTitle('Data')/items(6)"
Or this query:
requestUri = "/_api/lists/GetByTitle('Data')/items?$select=ID,Title,Department/Title&$expand=Department&$filter=ID eq 6"
I am not getting the data from the lookup fields.
What could be going wrong here?
La solution
Try your endpoint like:
requestUri = "/_api/web/lists/GetByTitle('Data')/items(6)?$select=ID,Title,Department/Title&$expand=Department
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange