Is it possible to update /add custom metadata of a powerpoint file using microsoft graph API? I am using this API
POST https://graph.microsoft.com/v1.0/me/drive/items/{file-id}/extensions Content-Type: application/json Authorization: Bearer {access_token} body: JSON.strigify({ "@odata.type": "microsoft.graph.openTypeExtension", "extensionName": "customMetadata", "customProperty1": "Value1", "customProperty2": "Value2" })
However I am getting this error
{ "error": { "code": "invalidRequest", "message": "[openExtension] The specified type named microsoft.graph.openTypeExtension is not recognized.", "innerError": { "date": "2024-11-22T11:58:03", "request-id": "7e156e41-f312-4221-9b5e-3235b9ecfce2", "client-request-id": "846b93a2-b2b5-00e4-57a9-6d97a77da548" } } }
Getting the same error in graph explorer as well. Scopes are User.ReadWrite.All ,User.ReadWrite
Note that, creating open extensions and adding custom properties in it are supported by specific resources only. To know what resources support open extensions, you can refer this MS Document.
Initially, I too got same error when I tried to create open extension on user's drive item with below API call:
POST https://graph.microsoft.com/v1.0/me/drive/items/itemId/extensions
{
"@odata.type": "microsoft.graph.openTypeExtension",
"extensionName": "customMetadata",
"CustomProperty1": "Value1",
"CustomProperty2": "Value2"
}
Response:
When I tried to create open extensions on supported resources like only user's /me
endpoint, it worked as below:
POST https://graph.microsoft.com/v1.0/me/extensions
{
"@odata.type": "microsoft.graph.openTypeExtension",
"extensionName": "customMetadata",
"CustomProperty1": "Value1",
"CustomProperty2": "Value2"
}
Response:
For adding custom metadata to OneDrive items, there is one feature named custom facets which is currently in Preview state. For more details, you can refer this MS Document.