I have a SharePoint list which has managed meta data field& lookup field. I want to retrieve the field values and show in HTML table format using rest api.
The SharePoint REST API has a little... I don't know what to call it - extension method? - anyway, an endpoint called
FieldValuesAsText which will give you what you want.
I haven't used it too much, but from just now playing around with it a bit in Postman, it seems like in order for it to work properly, you will need to know the ID of the list item you are getting the values for, and you will have to make individual calls for each item if you are trying to get more than one. It looks something like this:
Then in the result object, it will have the regular internal field names as the properties, but the values of both lookup fields and managed metadata fields will be the text label value you are looking for.
I tried to get the values for multiple list items at the same time by doing
but that didn't work as expected. The
FieldValuesAsText property of the result objects was populated (i.e. expanded), but in that, the values of the lookup and managed metadata fields were the term or lookup IDs, not the text label values.