Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

sharepoint online - Microsoft GraphApi: how to filter SPO results

I have a SPO site within a SPO site collection. My site has a DocumentLibrary and inside it 3 folders (Alfa, Beta and Gamma): I would like to get get the ID of one of them (for example Beta) by Graph API.

I can get all of them by writing:

https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives/

I can select a specific fields:

https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives?$select=name,id

but I can't filter the results, the following requests return always the same results of the first one:

https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives?$filter=name eq 'Beta' https://graph.microsoft.com/v1.0/sites/[id site collection]/sites/[id site]/drives?filter=name eq 'Beta'

. Does anyone know why and explain me how to filter?

Thanks in advance.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As of now you cannot use ODATA query parameter $filter to filter the document libraries as it is documented that it can support only few query parameters. There is already a feature request raised in Microsoft Graph Feedback Forum, please upvote it so that the product team may develop it in future.

For now you should query it on your end(Client side) using list drives and pick the required drive object by the name property from drive objects listed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...