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

Community site session details

Session Id : 25dloC/Wf3wXC4cZE7BgYt
Power Automate - Building Flows
Unanswered

Add a taxonomy field (managed metadata) site column to a library using rest api

Like (0) ShareShare
ReportReport
Posted on 31 Jul 2023 20:45:49 by 85

I have site columns that are managed metadata type that need to be added to a library after it is created using Power Automate action HTTP call to SharePoint.  Is there a FieldTypeKind for a taxonomy field?  I have the xml schema for the site column. I have scoured Google and this community to find a solution but I am not seeing a solution or answer to a question from a few years ago.  The following is what I have  but I am receiving the error "A node of type 'PrimitiveValue' was read from the JSON reader when trying to read the start of an entry. A 'StartObject' node was expected."

 

 

 

Site Address: <My tenant>/sites/<my site>
Method: POST
Uri: _api/web/lists/getByTitle('@{triggerOutputs()?['body/ProjectName/Value']})/fields

Headers: {
 "Accept": "application/json;odata=verbose",
 "Content-Type": "application/json;odata=verbose"
}

Body: "parameters":{
"__metadata":{
"type": "SP.Field"
},
"FieldTypeKind": 15, "Title": "RetentionStatus", "SchemaXml": "<Field Type="TaxonomyField" DisplayName="RetentionStatus" Description="" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" Group="Retention Columns" StaticName="RetentionStatus" Name="RetentionStatus"></Field>
}

 

 

 Any assistance will be much appreciated.

 

Thank you!

I have the same question (0)
  • Expiscornovus Profile Picture
    32,245 Most Valuable Professional on 03 Jan 2025 at 15:20:47
    Add a taxonomy field (managed metadata) site column to a library using rest api
     
    Sorry to bump this one, but I was searching for the same answer (the required SchemaXml payload to create this type of field).
     
    In my search I came across an approach on a blog from Beau Cameron:
     
    In that blog he has shared the SchemaXml values for both the (related hidden) Note field and the Taxonomy field itself.
     
    I have adapted that to a Power Automate cloud flow setup with two HTTP requests:
     
    Note Field payload (make sure you update the FieldName & Guid)
    {"parameters":{"__metadata":{"type":"SP.XmlSchemaFieldCreationInformation"},"SchemaXml":"<Field ID='{@{variables('Guid')}}' SourceID='http://schemas.microsoft.com/sharepoint/v3' Type='Note' Name='@{variables('FieldName')}TaxHTField' StaticName='@{variables('FieldName')}TaxHTField' DisplayName='@{variables('FieldName')}TaxHTField' Group='Test group' ShowInViewForms='FALSE' Required='FALSE' Hidden='TRUE' CanToggleHidden='TRUE' />","Options":12}}
     
    Taxonomy Field payload (make sure you update the FieldName, Guid, TermstoreId and TermSetId)
    {"parameters":{"__metadata":{"type":"SP.XmlSchemaFieldCreationInformation"},"SchemaXml":"<Field Type='TaxonomyFieldType' Name='@{variables('FieldName')}' SourceID='http://schemas.microsoft.com/sharepoint/v3' StaticName='@{variables('FieldName')}' DisplayName='@{variables('FieldName')}' Group='Test group' ShowField='Term1033' Required='FALSE' EnforceUniqueValues='FALSE' Mult='FALSE'> <Default></Default> <Customization> <ArrayOfProperty> <Property> <Name>SspId</Name> <Value xmlns:q1='http://www.w3.org/2001/XMLSchema' p4:type='q1:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>@{variables('TermStoreId')}</Value> </Property> <Property> <Name>GroupId</Name> </Property> <Property> <Name>TermSetId</Name> <Value xmlns:q2='http://www.w3.org/2001/XMLSchema' p4:type='q2:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>@{variables('TermSetId')}</Value> </Property> <Property> <Name>TextField</Name> <Value xmlns:q6='http://www.w3.org/2001/XMLSchema' p4:type='q6:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{@{variables('Guid')}}</Value> </Property> <Property> <Name>AnchorId</Name> <Value xmlns:q3='http://www.w3.org/2001/XMLSchema' p4:type='q3:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>00000000-0000-0000-0000-000000000000</Value> </Property> <Property> <Name>IsPathRendered</Name> <Value xmlns:q7='http://www.w3.org/2001/XMLSchema' p4:type='q7:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>false</Value> </Property> <Property> <Name>IsKeyword</Name> <Value xmlns:q8='http://www.w3.org/2001/XMLSchema' p4:type='q8:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>false</Value> </Property> <Property> <Name>Open</Name> <Value xmlns:q5='http://www.w3.org/2001/XMLSchema' p4:type='q5:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>false</Value> </Property> </ArrayOfProperty> </Customization> </Field>","Options":12}}
     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel
     
  • NotFlowing Profile Picture
    22 on 29 Feb 2024 at 17:03:34
    Re: Add a taxonomy field (managed metadata) site column to a library using rest api

    @ArneRavndalwould you mind showing the xml schema you're using?
    I'm trying to add a managed metadata field from my existing site columns to a sharepoint library. It does show the column name, but not the tags inherited from the taxonomy field

  • ArneRavndal Profile Picture
    2 on 26 Jan 2024 at 10:55:37
    Re: Add a taxonomy field (managed metadata) site column to a library using rest api

    Hi 🙂 

    I see this is half a year old, but I am also looking into this.

     

    I have found that I can add the managed metadata field using power automate just as you tried. 

     

    I found that using the GetByTitle('{title}')/Fields/createFieldAsXML endpoint 

    works fine. I am adding several fields at once, from an array of xmlschemas like this: 

    {
    "parameters": {
    "__metadata": { "type": "SP.XmlSchemaFieldCreationInformation" },
    "SchemaXml": " @replace(item(), '"','\"}'

    " }
    }

     

    After this runs I have access to adding tags from the termstore to the items in the list 🙂 

  • IntraAdmin Profile Picture
    85 on 10 Aug 2023 at 20:39:59
    Re: Add a taxonomy field (managed metadata) site column to a library using rest api

    Thank you!

  • skarthanal25 Profile Picture
    87 on 01 Aug 2023 at 16:47:25
    Re: Add a taxonomy field (managed metadata) site column to a library using rest api

    I was trying to accomplish the very same.  Unfortunately, it seems that the there is no field type kind for a managed metadata term.  In fact, I have researched and found that it is not supported via the REST calls.  This will have to be done in PowerShell or JSOM/CSOM.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 954 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 650 Moderator

#3
trice602 Profile Picture

trice602 327 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete