Jul 26 2023 01:42 AM
I've been working with the TermStore in Microsoft Graph, using the official documentation I've managed to get a CRUD system of Terms. The whole point of the TermStore is using these terms with files, so I thought it would be also easy to add those terms into files, foolish of me to think that. I've tried to search, and I didn't find any way to do that, I know using the SharePoint REST API or CSOM or PnP is possible, but it feels to me very anti-intuitive, why Microsoft would give the possibility to perform CRUD operations on terms, but then there is no way to add those terms into files? Maybe it's just me that I didn't find how to do it.
This is what I've tried:
If I make this HTTP call, the object that I receive doesn't show the Taxonomy property, so I can't make a PATCH call to modify that value because it simply doesn't appear.
GET https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{item-id}?expand=listItem
And if I do this HTTP call, the object has the Taxonomy property
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/Documents/items/{item-id}?expand=fields
So I've tried to make a PATCH, sending this to the body
{ "fields": { "email address removed for privacy reasons": "#Collection(microsoft.graph.Json)", "TaxKeyword": [ { "Label": "Test1", "TermGuid": "1b20b62d-7ee9-4f55-9ecf-88e622a3f7d7" } ] } }
(I am using an existing Term that I've created with the CRUD system, but I don't know how to get the WssId, I am not sure if it is necessary or if it is even possible to obtain it)
But it appears the generic error "invalidRequest".
And is not a problem of permissions, my app has Files.ReadWrite.All, Sites.ReadWrite.All and TermStore.ReadWrite.All
I hope that there is a solution, and it's just me that I can't search well
Thank you