cancel
Showing results for 
Search instead for 
Did you mean: 

Managed Metadata column is supported in OData Filter Query

I would like to request to enable Managed Metadata column in OData Filter Query.

Thus it's easier for us to do filtering the value from Managed Metadata column before proceed the next action.

Please help.

Thanks.

 

Cheers,

VTEC

Status: New
Comments
FlorianTrine
Frequent Visitor

It would be usefull to filter in odata query by metadata value
The query would be something like
Get Items where"myTaxonomyField" equal "value"

I would like to query on the exact term value, without having to give the full path in the termset.

 

 If my termset is built as following, I would like to query "myTaxonomyField eq 'France'"

I don't want to have to build a query "myTaxonomyField eq 'Europe>France'".

Taxonomy example :  

- Asia

    - China

    - Japan

- Europe

    - France

    - United Kingdom.

westerdaled
Resolver I

Hi 

 

I have been trying this in the SharePoint: GetItems action  and I can't get it to work

 

 

 

MetacolumnLabel  eq 'annoying'

 

 

 

Anyone got this to work? 

SchneidAIR
Advocate III

It is not possible to OData Filter Query on Managed Metadata Columns (SharePoint Taxonomy). Also no "Contains" Filter Condition.

You have to use HTTP Request to SharePoint with a CAML Query Syntax, like this one

 

MMS-Caml1.png

 

_api/web/Lists/GetByTitle('Retention%20Periods')/GetItems(query=@v1)?@v1={"ViewXml":"<View><Query><Where><Eq><FieldRef Name='imsDocumenttype'/><Value Type='TaxonomyFieldType'>@{body('Get_file_properties')?['imsDocumenttype']?['Label']}</Value></Eq></Where></Query></View>"}

 

The Output ['d']['results'] you have to Select and Parse for the required Filter Condition 

MMS-Caml.png

See also

sharepoint online - Filtering on Managed Metadata - MS Flow - SharePoint Stack Exchange

 

How to filter on a Managed Metadata column via REST in SharePoint 2013 – CleverWorkarounds

 

But this is a bit cumbersome and doesnt work well with multilingual Term Labels and does not work with multi-value MMS Columns.

Missing Managed Metadata Support for OData Filtering is very annoying.

 

Alternatives / Workarounds:

Solved: Filtering taxonomy - Power Platform Community (microsoft.com)

 

Filter a SharePoint list on a Managed Metadata field in a REST based client application – the IT gen...

 

 

 

westerdaled
Resolver I

Thanks for sharing @SchneidAIR  .  I have used on the workarounds you shared in the links .  

 

 

 

SchneidAIR
Advocate III

Get items and OData-Filter not possible with Managed Metadata Columns. Actually ypu have to use HTTP Request to SharePoint with CAML Query Syntax

 

But please consider, that Filtering on Mananged Metadata Columns (TaxonomyFieldType) with the Term Label will not work in multilingual Termsets with multilingual Term Translations.  

 
 

MMSTermLabel.png

 

Also beware when you attempt to use the Term GUID instead. This will not work, you will get no filter results.

I dont know why....

 

But instead you can use a HTTP Request to SharePoint with a CAML Query on Lookup-Filtertype on the Terms WSSID (this would be generated based of the local TaxonomyHiddenList of the Site Collection).

This Filter will also work in multilingual Taxonomy Environments on the same site...

 

MMSTermWSSID.png

 

Example

 

 

_api/web/Lists/GetByTitle('Responsibilities')/GetItems(query=@v1)?@v1={"ViewXml":"<View><Query><Where><And><And><Eq><FieldRef LookupId='TRUE' Name='imsProcess' /><Value Type='Lookup'>@{body('Get_file_properties')?['imsProcess']?['WssId']}</Value></Eq><Eq><FieldRef LookupId='TRUE' Name='imsDepartment' /><Value Type='Lookup'>@{body('Get_file_properties')?['imsDepartment']?['WssId']}</Value></Eq></And><Eq><FieldRef LookupId='TRUE' Name='imsLocation' /><Value Type='Lookup'>@{body('Get_file_properties')?['imsLocation']?['WssId']}</Value></Eq></And></Where></Query></View>"}