Oct 18 2017 01:35 AM
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
Oct 18 2017 03:13 AM
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
Joel
Oct 18 2017 03:56 AM - edited Oct 18 2017 03:58 AM
SolutionHi 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
Oct 18 2017 04:14 AM
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
Oct 18 2017 03:56 AM - edited Oct 18 2017 03:58 AM
SolutionHi 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