I am trying to make use of the following Microsoft Graph API endpoint to add an extension to a .pptx file:
POST https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/extensions
Content-Type: application/json
Authorization: Bearer {access-token}
{
"@odata.type": "microsoft.graph.openTypeExtension",
"extensionName": "CountMetadata",
"count":1
}
On calling this API, I am getting a 400 bad request error with the following details:
{
"error": {
"code": "invalidRequest",
"message": "[openExtension] The specified type named microsoft.graph.openTypeExtension is not recognized.",
"innerError": {
"date": "{date}",
"request-id": "{req-id}",
"client-request-id": "{client-req-id}"
}
}
}
I tried the extensions API on /me endpoint. It works there. Can anyone explain the reason for this behavior?
I tried using the API on drive items and was expecting it to create an extension but it didn't work
Open extensions for driveItem
are supported only in beta
version.
Do not include @odata.type
in the request body and ensure that the extension name starts with lower case.
POST https://graph.microsoft.com/beta/drives/{drive-id}/items/{item-id}/extensions
Content-Type: application/json
Authorization: Bearer {access-token}
{
"extensionName": "countMetadata",
"count":1
}