我们可以使用RESTAPI查询SharePoint Online中的多级查找列吗?
有3个SharePoint列表包含以下列: 个人列表:我们可以使用RESTAPI查询SharePoint Online中的多级查找列吗?,rest,sharepoint,sharepoint-2013,Rest,Sharepoint,Sharepoint 2013,有3个SharePoint列表包含以下列: 个人列表: 头衔 地址查找列 地址列表: 头衔 AddressTypeLookupColumn 地址类型列表: 头衔 我需要的是使用ODataRESTAPI的人名、地址和地址类型 以下是我的疑问: https://mysitecollection/sites/test/_api/web/lists/getbytitle('PersonList')/items?$select=Title,AddressLookupColumn/Title,Address
https://mysitecollection/sites/test/_api/web/lists/getbytitle('PersonList')/items?$select=Title,AddressLookupColumn/Title,AddressLookupColumn/AddressTypeLookupColumn/Title&$Expand=AddressLookupColumn,AddressLookupColumn/AddressTypeLookupColumn_
它给了我这个错误:
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.SharePoint.SPException</m:code>
<m:message xml:lang="en-US">
The query to field 'AddressLookupColumn/AddressTypeLookupColumn' is not valid.
</m:message>
</m:error>
-1,Microsoft.SharePoint.SPException
对字段“AddressLookupColumn/AddressTypeLookupColumn”的查询无效。
如何更正查询?SharePoint Rest调用中不支持嵌套查询 SharePoint REST API不支持两级
$expand
或嵌套查询。例如,您正在查询一个列表,而A在B列表中有一个查找列。B从C列表中有一个查找列。因此,如果要查询列表,则只能$expand
B的所有列
/_api/web/lists/getbytitle('A')?$select={columns for B}&$expand=B
不能从C中展开任何列。原因是A和C之间没有直接关系
解决方法#1:
首先,获取B列表的项目ID,对B列表进行另一个REST调用,并$expand
扩展C的列
/_api/web/lists/getbytitle('B')/items({ItemId})?$select={select column from c}&$expand=C
您可以使用$batch
请求一次获取多个项目,但SharePoint 2013不支持$batch请求
有关更多信息:
.SharePoint Rest调用中不支持嵌套查询 SharePoint REST API不支持两级
$expand
或嵌套查询。例如,您正在查询一个列表,而A在B列表中有一个查找列。B从C列表中有一个查找列。因此,如果要查询列表,则只能$expand
B的所有列
/_api/web/lists/getbytitle('A')?$select={columns for B}&$expand=B
不能从C中展开任何列。原因是A和C之间没有直接关系
解决方法#1:
首先,获取B列表的项目ID,对B列表进行另一个REST调用,并$expand
扩展C的列
/_api/web/lists/getbytitle('B')/items({ItemId})?$select={select column from c}&$expand=C
您可以使用$batch
请求一次获取多个项目,但SharePoint 2013不支持$batch请求
有关更多信息:
.我猜您不可能在一个查询中进行两级深度查找。您可能需要使用PersonList中的
AddressLookupColumn/ID
值对AddressList执行第二次查询。我猜您无法在单个查询中执行两级深度查找。您可能需要使用PersonList中的AddressLookupColumn/ID
值对AddressList执行第二次查询。