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?

有帮助吗?

解决方案

Try your endpoint like:

requestUri = "/_api/web/lists/GetByTitle('Data')/items(6)?$select=ID,Title,Department/Title&$expand=Department
许可以下: CC-BY-SA归因
scroll top