web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to Associate M...
Power Automate
Answered

Unable to Associate Managed Metadata Column with Term Set

(1) ShareShare
ReportReport
Posted on by 2

Hi everyone,

I'm currently working on automating the creation of a Managed Metadata column in a SharePoint Online library using Power Automate. I’ve successfully used the "Send an HTTP request to SharePoint" action to:

  • Add a TaxonomyFieldType column to a library using the CreateFieldAsXml endpoint.
  • Retrieve the field’s GUID using the /fields/getbyinternalnameortitle() endpoint.
  • Get a valid FormDigestValue using the _api/contextinfo endpoint for secure updates.

I can successfully create the metadata field with the following schema:

{
  "parameters": {
    "__metadata": {
      "type": "SP.XmlSchemaFieldCreationInformation"
    },
    "SchemaXml": "<Field Type='TaxonomyFieldType' DisplayName='Cool Metadata' StaticName='CoolMetadata' Name='CoolMetadata' ShowField='Term1033' Required='FALSE' EnforceUniqueValues='FALSE' Group='Test' />"
  }
}
 
I also successfully retrieve the field GUID via: _api/web/lists/getbytitle('Test')/fields/getbyinternalnameortitle('CoolMetadata') And get the FormDigestValue with _api/contextinfo.
 

When I attempt to associate the field with an existing Term Set via the /update endpoint, I get a 502 Bad Gateway error.

Here’s the full URI I’m calling (dynamically composed):

_api/web/lists/getbytitle('Test')/fields('<FieldGUID>')/update

Headers:

{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose",
  "X-RequestDigest": "<dynamic from contextinfo step>"
}

Body:

{
  "__metadata": { "type": "SP.Taxonomy.TaxonomyField" },
  "SspId": "2954755e-a0f9-4a35-a115-f7b718803e78",
  "TermSetId": "9dc7c5f5-21f1-41fe-b213-bd1438d78c43",
  "AnchorId": "00000000-0000-0000-0000-000000000000",
  "AllowMultipleValues": false,
  "Open": false
}

Error Message:

BadGateway
The parameter __metadata does not exist in method GetById.
clientRequestId: <GUID>
serviceRequestId: <GUID>

I’ve validated that:

  • The field is successfully created as a taxonomy field
  • The X-RequestDigest is being passed dynamically and is valid
  • The /update endpoint is correct syntactically (per SharePoint REST documentation)
  • Changing "__metadata": { "type": "SP.Taxonomy.TaxonomyField" } to "SP.Field" also results in the same error

Any insight would be appreciated. I’m trying to keep this within a native Power Automate context if possible, but open to options.

Thanks in advance!

—Chris

Categories:
I have the same question (0)
  • Verified answer
    SwatiSTW Profile Picture
    741 Super User 2025 Season 2 on at
    Creating the taxonomy field using REST works fine. You can use the CreateFieldAsXml endpoint to add a TaxonomyFieldType field. It auto-creates the hidden note field too. Use X-RequestDigest only when needed for updates.
     
    The issue is with associating the field to a term set. REST API doesn't support setting TermSetId, SspId, or AnchorId for taxonomy fields. That’s why your /update call returns a 502 error. These properties require CSOM or PnP.PowerShell.
     
    To make it work, use an Azure Function or Azure Automation Runbook to run PnP PowerShell or C# CSOM. Power Automate will trigger this via HTTP action. Note: HTTP action needs Premium license. Avoid using /ProcessQuery — it’s unsupported and unstable in flows.
     
    Here’s a working PnP PowerShell snippet:
    Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/yoursite" -Interactive
    $field = Get-PnPField -List "Test" -Identity "CoolMetadata"
    Set-PnPTaxonomyField -Field $field -TermSetId "9dc7c5f5-21f1-41fe-b213-bd1438d78c43" -TermStoreId "2954755e-a0f9-4a35-a115-f7b718803e78"
     
    So use REST to create the field, but CSOM (via Azure Function or Runbook) to link it to a term set. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard