admin管理员组

文章数量:1122832

Is it possible to update /add custom metadata of a powerpoint file using microsoft graph API? I am using this API

POST .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

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

Share Improve this question edited Nov 22, 2024 at 12:06 Sridevi 21.6k1 gold badge9 silver badges27 bronze badges Recognized by Microsoft Azure Collective asked Nov 22, 2024 at 12:05 akaparadoxakaparadox 275 bronze badges 4
  • AFAIK, you can add custom metadata to user's resource like events, messages and contacts but not on drive items. Refer this MS Document learn.microsoft.com/en-us/graph/api/… – Sridevi Commented Nov 22, 2024 at 12:30
  • Hi @akaparadox Any update? – Sridevi Commented Nov 27, 2024 at 4:06
  • 1 Hi @Sridevi , yes you are correct, as of now we can't add metadata to custom files in Microsoft OneDrive – akaparadox Commented Nov 27, 2024 at 5:19
  • Also @Sridevi ,If possible can you also look at this query please? stackoverflow.com/questions/79189131/… It's not related to graph APIs, but with respect to Microsoft PowerPoint Web. – akaparadox Commented Nov 27, 2024 at 5:22
Add a comment  | 

1 Answer 1

Reset to default 1

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.

本文标签: reactjsUpdate metadata of powerpoint file using microsoft graph APIStack Overflow