[英]Unable to fetch lookup field values using REST api
I am using REST api to fetch data from a SharePoint list.我正在使用 REST api 从 SharePoint 列表中获取数据。
I am able to get the lookup fields data using this query: requestUri = "/_api/lists/GetByTitle('Data')/items?$select=ID,Title,Department/Title&$expand=Department
.我可以使用此查询获取查找字段数据:
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.但是,当我使用此查询
requestUri = "/_api/lists/GetByTitle('Data')/items(6)"
或此查询requestUri = "/_api/lists/GetByTitle('Data')/items?$select=ID,Title,Department/Title&$expand=Department&$filter=ID eq 6"
我没有从查找字段中获取数据。
What could be going wrong here?这里可能出了什么问题?
The issue was found.问题已找到。
Figured out that I was fetching an item for which all the lookup fields were blank.发现我正在获取一个所有查找字段都是空白的项目。
I fetched another item, and data was returned as expected.我取了另一个项目,数据按预期返回。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.