Forum Discussion

dotem's avatar
dotem
Copper Contributor
Dec 26, 2022

Managed Metadata Column, Term Label Returns Some ID Instead of Actual String Value

I have a flow which will get file properties from a library that contains a managed metadata column. But when I run the flow, the term label value returns some ID instead of the actual string value.

 

The actual Label value should be something like "Fire Protection" and not 109.

 

I can't find a way to get the Label string using any other way. 

Is this the actual behavior or it's a bug? I'm not sure. 

Is there any other way to get the Label value?

 

Thanks. 

 

 

  • aneetz's avatar
    aneetz
    Brass Contributor

    Hi dotem 

     

    I tried to replicate your scenario but I was able to get the managed metadata column value correctly in the flow. 

     

    My column name is 'MMD', and I used the step 'Get file properties' (SharePoint) and was able to get the output as below :

     

    Do you not get the same output when using the step 'Get file properties'? 

    How is your term store values configured? 

     

    Regards,

     

     

  • SvenSieverding's avatar
    SvenSieverding
    Bronze Contributor

    Hi dotem ,

     

    this issue depends on how exactly you are accessing the file properties from the document library.

    This for example works without problems if i use the action "Get files (properties only)".
    But i get the same (wrong) results as you, if i use an "Send an HTTP request to SharePoint" action like this

    _api/web/lists/getbytitle('<ListName>')/items


    If you use the "Send an HTTP request to SharePoint" action you should take a look at the following article for a workaround to that case:

    "https://sympmarc.com/2017/06/19/retrieving-multiple-sharepoint-managed-metadata-columns-via-rest/" .
    The idea is to expand the "TaxCatchAll" Field like this (MM is my metadata colum)

    _api/web/lists/getbytitle(<ListName>)/items?$select=Title,MM,TaxCatchAll/ID,TaxCatchAll/Term&$expand=TaxCatchAll

    Now you will still get the wrong value for die metadata column, but you will now get an additional "TaxCatchAll" property where you can lookup the correct label for the id

    "MM": {
        "__metadata": {
          "type": "SP.Taxonomy.TaxonomyFieldValue"
        },
        "Label": "5",
        "TermGuid": "cd04183c-45ce-4e21-b53d-c36659f5cee9",
        "WssId": 5
      },
      "TaxCatchAll": {
        "results": [
          {
            "__metadata": {
              "id": "771205b8-8892-442b-a76a-a4e22a786883",
              "type": "SP.Data.TaxonomyHiddenListListItem"
            },
            "ID": 5,
            "Term": "Term2"
          }
        ]
      }



    If it is not the case that you are using the "Send an HTTP request to SharePoint" action to get the file metadata...
    Which PowerAutomate action exactly are you using to get the properties from SharePoint?


  • Murphybp2's avatar
    Murphybp2
    Copper Contributor

    I'm having the same issue.  I'm using the "Get files (properties only)" action. 

     

     

    This is what I see in the raw output.  

     

    I haven't been able to figure out how to get the actual label name. 

    • Jeza518's avatar
      Jeza518
      Copper Contributor

      Murphybp2 

       

      I have had a similar issue, when i am running Power Automate, Flow using the SharePoint, Get List Item, to return metadata value, labels.

      the output returns the metadata ID, not the label that was requested.

      This does not works on some lists and other are fine, they return the label.

       

      After testing, lists that have been created using the 'From existing list' option,

      create lists with Content Types, that are local to the list, (there parent is the Item)

       

      Where as the lists that are working as expected, have been created manually with the Site Column and the Content Type being set up first, in the site, then added to a new list. This give you a parent Content Type in the site content type list

       

      Note: Doing this manually or using PowerShell to the the list up both create list that does not have the metadata issues with Power Automate flows.

       

      To resolve this I have rebuilt my problematic lists setting up the Content Type first manually (or with PowerShell) adding them to my new list and migrated the data.

       

      Note: I create list like this ordinarily, but i notices this when you let the users lose with list creation, and they turn in to a 'Critical System' that needs some automation applied.

       

      anyway, hope this helps.

      • cwitzke's avatar
        cwitzke
        Brass Contributor
        Thank you SO MUCH! I think you have diagnosed my problem as well as I have same error with some lists / flows working and some not. The most recent set of lists were created "from an existing list" and I am encountering the error. I expect it will be the same if we use the "Create a new library - from an existing library" too, which is a pain because I just set up a "template" library, and it isn't going to operate that way if it doesn't pull the metadata properly when I try to use Power Automate on it. That might explain some other weird behaviour I'm seeing in other libraries with metadata columns. Huh. Thank you thank you for the heads up!

Resources