简体   繁体   中英

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.

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.

According to my research and testing, unfortunately, there is currently no Graph API can filter items by CreatedBy User. As a workaround, I recommend you use the following REST API to filter items:

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 . The filtering can be allowed by adding the 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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM