SharePoint Onlie REST Api LookUp查询

时间:2018-03-07 15:26:32

标签: ajax sharepoint-online sharepoint-api

我正在尝试构建SharePoint在线查询。有些专栏是 LookUp列。我想从uQmsParent列中获取源自我想要描述的列表的描述。该列被称为" uQmsDescription"。我用Google搜索并找到了很多答案。但是没有一个解决方案适合我。

查询:

_spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Processobjekt')/items?$select=Title,Id,uQmsDescription,uQmsOrder,uQmsType,uQmsBgColor,uQmsArea/Id,uQmsParent/Id,uQmsParent/Title,uQmsResponsible/Title,uQmsResponsible/uQmsName&$expand=uQmsArea,uQmsParent,uQmsResponsible&$filter=uQmsParent/Id eq '" + processItemId + "'&$orderby=uQmsOrder asc"

我可以毫不费力地获得身份和头衔。但是当我向选择查询添加uQmsParent / uQmsDescription时,我收到此错误The question in the uQmsParent/uQmsDescription field is not valid.

这就是查询生成错误的方式:

_spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Processobjekt')/items?$select=Title,Id,uQmsDescription,uQmsOrder,uQmsType,uQmsBgColor,uQmsArea/Id,uQmsParent/Id,uQmsParent/Title,uQmsParent/uQmsDescription, uQmsResponsible/Title,uQmsResponsible/uQmsName&$expand=uQmsArea,uQmsParent,uQmsResponsible&$filter=uQmsParent/Id eq '" + processItemId + "'&$orderby=uQmsOrder asc"

非常感谢帮助。

1 个答案:

答案 0 :(得分:0)

看起来您的查询错误,您没有在$ expand参数中获得所需的值。

它应该像:

$ select = Title,Id,uQmsDescription,uQmsOrder,uQmsType,uQmsBgColor,uQmsArea / Id,uQmsParent / Id,uQmsParent / Title,uQmsParent / uQmsDescription,uQmsResponsible / Title,uQmsResponsible / uQmsName& $ expand = uQmsArea / Title,uQmsParent /标题,uQmsResponsible /编号

这里非常好地解释了如何使用查找:

https://social.technet.microsoft.com/wiki/contents/articles/35796.sharepoint-2013-using-rest-api-for-selecting-filtering-sorting-and-pagination-in-sharepoint-list.aspx