SOLVED

REST API bug when retrieving managed metadata list field configured to allow single values?

MVP

Hi everyone,

 

Any suggestion on this problem would be much appreciated.

I'm trying to load all the items from a list that contains some managed metadata fields using the REST api.

The API returns back an Id in place of the Label value

The list is located on a sub web, so I can't play with TaxCatchAll

The fields are configured to store single values. If set to multi values, the API returns the correct term Label, although, changing the fields is not an option

 

This feels more like a bug on the API to me...Anyone experienced this before? 

Any ideas on how to handle this scenario within the REST api?

 

Many thanks

Joel

 

 

3 Replies

I have now gave up and used JSOM to load the data...although I would still like to hear suggestions if you have come across this scenario before.

 

In case you are working with SPFx web parts and need to use JSOM for some reason (REST is the recommended approach and I trust everyone will understand why), this article provides excellent guidance on how to quickly setup everything and get started

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-sharepoint-using-... 

 

Joel

best response confirmed by Joel Rodrigues (MVP)
Solution

Hi Joel,

 

This is a well-known issue since 2013.

Single-valued MMD columns just can be retrieved as desired with OData, with Multi-valued MMD columns it is much better.

 

But there is a workaround. There is a possibility of getting single-valued MMD columns' values while items request if do it with `getItemsByCAMLQuery` list's method. It's a part of REST API, is an implementation for backward compatibility. The downside of the approach is that OData configurators like ($select, $filter, $expand and so on) can't be used together with OData.

 

--

Regards,

Andrew

Hi Andrew, thanks for your reply!

 

To be honest, I was really surprised to never come across this limitation before :)

I did found some blog posts describing the CAML workaround, but between that and the JSOM, I ended up with JSOM.

 

Joel

1 best response

Accepted Solutions
best response confirmed by Joel Rodrigues (MVP)
Solution

Hi Joel,

 

This is a well-known issue since 2013.

Single-valued MMD columns just can be retrieved as desired with OData, with Multi-valued MMD columns it is much better.

 

But there is a workaround. There is a possibility of getting single-valued MMD columns' values while items request if do it with `getItemsByCAMLQuery` list's method. It's a part of REST API, is an implementation for backward compatibility. The downside of the approach is that OData configurators like ($select, $filter, $expand and so on) can't be used together with OData.

 

--

Regards,

Andrew

View solution in original post