I'm using the Microsoft Graph API to process a bunch of files and emails from Office365 (OneDrive, Sharepoint, Exchange Online).
This works well, fetching the OneDrive records via https://learn.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0&tabs=http = https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{dir_id}/children. No problem there.
But now I need to assign a Purview label to some of these items using the Purview API: https://learn.microsoft.com/en-us/rest/api/purview/catalogdataplane/entity/add-label?tabs=HTTP
All the Purview API documentation talks about "guid – The globally unique identifier of the entity" as input, to specify which document I want to assign the label to. How do I get that guid?
I don't see any "guid" attribute in my OneDrive responses. To be honest I got completely lost in the infinite indirections and IDs of the Microsoft API.
How do Graph API responses relate to Purview GUIDs?
Not sure whether it's the same, but the Graph API beta allows you to set retention label on
driveItemProbably, you don't need to call Purview API.
If you want apply a label using Purview API, parse GUID from
eTagproperty of thedriveItem.Resource:
Apply retention policy