Setting SharePoint Managed Metadata Fields via Graph API

AR 25 Reputation points
2025-05-20T17:59:02.7866667+00:00

I'm trying to set the fields on a SharePoint document via Microsoft Graph API. I'm using a Content Type, local to my site, that inherits a global Content Type. I can set string and date columns that match the local content type successfully but whenever I try to change a managed managed metadata field, I get a 400 "Invalid request" response without any context.

.../drives/{driveId}/items/{fileId}/listItem/fields - PATCH

// Feed in the same object style that came from `listItem/fields` GET
{
   "Managed_x0020_FieldName": {
       "Label": "Label Here",
       "TermGuid": "{GUID here}",
       "WssId": 123
   }
}

// Pipe separated like SP UI validation POST input
{
   "Managed_x0020_FieldName": "Label Here|{GUID here};"
}

// By column Id -- fetched from `{SiteId}/lists/{ListId}/columns`
// Tried other value combinations -- returns field not recognized
{
   "{Column Id here}": {
        "Label": "Label Here",
        "TermGuid": "{GUID here}",
        "WssId": 123
   }
}

I've seen other questions here that claim that setting a managed metadata field is not supported by the Graph API but I'm hearing the opposite from other sources claiming services where the Graph API is setting these successfully. Am I missing something in the input or is this documented somewhere what is and isn't supported?

One theory is it may be a permission issue -- i.e I might need global permissions to set this field? Seems strange that I can successfully query the terms with my current credentials and there's no indication of permission issues in the error.

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sonny Gillissen 3,996 Reputation points Volunteer Moderator
    2025-05-26T19:18:22.8833333+00:00

    Hi AR

    Thanks for reaching out on Microsoft Q&A!

    First off: you're not alone! I found this answer on Stack Overflow leading to the solution:

    Here is how I was finally able to do this. First you need the id of the hidden field which is the displayName corresponding to your field CakeType which should be CakeType_0. I used this REST call to get find the id:

    https://graph.microsoft.com/v1.0/sites/{sitid}/lists/{listid}/items?expand=hidden

    This will return all your fields and you want the one with the _0 suffix:

    ..."displayName": "Cake_0",...

    "name": "d39a5181f12f41a483acb1a4e47477b1"...

    It is this name id you need to use to update the field.

    So then the PATCH call on your item is like this:

    https://graph.microsoft.com/v1.0/sites/{sitid}/lists/{listid}/items/{itemid}

    Then the payload syntax is like this:

    {"{FieldID}":"{TermNumber};#{Term}|{TermGuid}"}

    So it would look like this (assuming Apple is the 4th tag although I think -1 might work there too):

    {"d39a5181f12f41a483acb1a4e47477b1":"4;#Apple|3a3ad73f-94ca-4d1e-a25c-XXXX"}

    For more than one tag separate them with ;# all within the same quoted string

    Please find the link below as source reference:

    https://stackoverflow.com/questions/55033458/cant-update-sharepoint-managed-meta-data-field-from-microsoft-graph-explorer

    Please click ‘Accept answer’ if you think my answer is helpful. Feel free to drop additional queries in the comments below!

    Kind regards,

    Sonny

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.