[英]Microsoft Graph API Filter SharePoint List Items By CreatedBy User
I am using Microsoft Graph API and trying to filter items in a SharePoint List by CreatedBy User but am not sure how to write the filter query.我正在使用 Microsoft Graph API 并尝试通过 CreatedBy User 过滤 SharePoint 列表中的项目,但我不确定如何编写过滤查询。
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$$filter= https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$$filter=
I have tried "https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?&$filter=AuthorLookupId eq {user-id}" but it doesn't seem to work.我试过“https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?&$filter=AuthorLookupId eq {user-id}”但是它似乎不起作用。
According to my research and testing, unfortunately, there is currently no Graph API can filter items by CreatedBy User.根据我的研究和测试,不幸的是,目前没有图 API 可以按 CreatedBy User 过滤项目。 As a workaround, I recommend you use the following REST API to filter items:作为解决方法,我建议您使用以下 REST API 来过滤项目:
https://xxxxx.sharepoint.com/sites/xxx/_api/web/lists/getbytitle('xxxx')/items?$filter=AuthorId eq 21
Thanks for your understanding.谢谢你的理解。
You can at least filter items by field AuthorLookupId
.您至少可以按字段AuthorLookupId
过滤项目。 The filtering can be allowed by adding the header Prefer: HonorNonIndexedQueriesWarningMayFailRandomly
.可以通过添加 header Prefer: HonorNonIndexedQueriesWarningMayFailRandomly
来允许过滤。
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields&filter=fields/AuthorLookupId eq '10'
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields&filter=fields/Title eq 'whatever'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.