SharePoint Online Rest API update managed metadata columns

Occasional Contributor

Hello Community,


I am trying to implement an API based file upload using the following Microsoft tutorial:

The upload is already working and I'm stuck on the last step, updating the file metadata.

It was already possible for me to update simple text lines.
But since I unfortunately have to update managed meta data columns as well, I am now stuck with this challenge.

The itemMetadata variable was set as follows and contains the following data of the file:
- uri

// code to set var itemMetadata



itemMetadata = return jQuery.ajax({
      url: fileListItemUri,
      type: "GET",
      headers: { "accept": "application/json;odata=verbose" }


Now to the crux of the matter.
I set the variable body as follows to update the metadata.
The variable md contains the metadata I want to update. this is from a sharepoint list consisting of the same taxonomy store.


var body = JSON.stringify({


Then the update is triggered as follows.


return jQuery.ajax({
        url: itemMetadata.uri,
        type: "POST",
        data: body,
        headers: {
          "X-RequestDigest": reqDigest,
          "content-type": "application/json;odata=verbose",
          // "content-length": body.length,
          "IF-MATCH": itemMetadata.etag,
          "X-HTTP-Method": "MERGE"
        success: (xhr) => {
        error: (xhr) => {


I get no error and the Title field is also updated as expected. Only the Managed Metadata field remains empty. The consoles log "success!?!" is displayed.

I have already read in other forums that this call does not work and it was suggested to use JSOM. but in my opinion this is not a solution, especially since it is described in the original Microsoft article.
Did anyone succeed?
cheers Saintenr

This code is executed in a Web Part in the context of the Sharepoint online workbench.

4 Replies
Hello, an update from me.
The problem why the metadata columns could not be updated was that the Document Library had default values set for folders and subfolders. If this function is active, no managed metadata column can be updated via the api...

Possible solution:
Delete this default value rules for every folder on the library.

Hope this will helps other users too.

Cheers Saintenr
best response confirmed by Saintenr (Occasional Contributor)

After contact with Microsoft support we have come to the conclusion that it is not necessary to delete the default values for the columns. The following format is possible and works fine.
The URI only needs to be extended by one function. 


The ValidateUpdateListItem function needs this json format as body:
"FieldName": "Metadatacolumn", 
"FieldValue": taxItemLabel + '|' + taxItemTermGuid
"bNewDocumentUpdate": false




@Saintenr Hello, I am in the process of migrating data to sharepoint and have a requirement to update the metadata for managed MetaData fields for documents uploaded. I need to download the TermGuid for all the items in the TermSet. I will have to then pass the TermGuid and Label to the update document API call. I do not see any REST API avaiable to download the  TermSet information for a specific managed meta data field. In your code example I see that you already have this information. Where and how are you getting this information. It would be really helpful if you can tell me how you are getting this information. Thanks so much for your help!

@shamala2020 sorry for the late response. You have to select these columns in your request: