简体   繁体   中英

How to filter Sharepoint Terms in Microsoft Graph API?

How can I filter Sharepoint Terms by name using Microsoft Graph API?

Here is a sample of results returned by the request without filter:

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#termStore/groups('xxxxxxxxx')/sets('xxxxxx')/terms",
    "value": [
        {
            "id": "fb0d9476-4cec-46d5-acd5-12245de95308",
            "createdDateTime": "2017-06-28T15:07:44.18Z",
            "lastModifiedDateTime": "2021-03-12T11:31:36.137Z",
            "labels": [
                {
                    "name": "Hello",
                    "isDefault": true,
                    "languageTag": "en-US"
                }
            ],
            "descriptions": []
        },

I tried to filter like this:

  • GET https://graph.microsoft.com/beta/termStore/groups/xxxx/sets/xxxx/terms?filter=labels/name eq 'Hello' ;
  • and with expand: GET https://graph.microsoft.com/beta/termStore/groups/xxxx/sets/xxxx/terms?labels($filter=name eq 'Hello') .

But any request worked ( Invalid filter clause , Parsing OData Select and Expand failed: Property 'labels' on type 'microsoft.graph.termStore.term' is not a navigation property or complex property. Only navigation properties can be expanded. ).

Thanks for your help!

您应该使用如下过滤器:

?$filter=labels/any(s:s/name eq 'Hello')

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