graph api broken: unable to retrieve item attachment from a calendar event

CAT 26 Reputation points
2024-08-26T10:00:59.3666667+00:00

Hi there,

I used attachment api (GET events/{id}/attachments/{id}?$expand=microsoft.graph.itemAttachment/item) for downloading item attachments from calendar events.

It worked well until few weeks ago(not sure the exact time, I just found the error this weekend).

It returns a sever error(status code: 500) An internal server error occurred. The operation failed., Index was outside the bounds of the array..

It looks like that the Microsoft develop team has changed the behavior (looks like a bug) without mentioning it in the changelog and documents.

I would appreciate any insights or guidance on resolving this issue.

Thanks.

some documents:

https://learn.microsoft.com/en-us/graph/api/resources/itemattachment?view=graph-rest-1.0

https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,774 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Oliver 0 Reputation points
    2024-08-28T13:52:21.6133333+00:00

    I can confirm this.

    I tested with https://developer.microsoft.com/en-us/graph/graph-explorer


    Mail 1 - Attachment = Mail

    "@odata.type": "#microsoft.graph.itemAttachment",

    https://graph.microsoft.com/v1.0/users/test@company.com/mailFolders/Inbox/messages/AAM..( MessageID)...9AAA=/attachments/AAMk..(AttachmentID)..AZT8=/$value

    Result: get the raw mail successfully


    Mail 2 - Attachment = Apoinment

    "@odata.type": "#microsoft.graph.itemAttachment",

    https://graph.microsoft.com/v1.0/users/test@company.com/mailFolders/Inbox/messages/AAX..( MessageID)...7AAA=/attachments/AAXk..(AttachmentID)..BK3=/$value

    or

    https://graph.microsoft.com/v1.0/users/test@company.com/mailFolders/Inbox/messages/AAX..( MessageID)...7AAA=/attachments/AAXk..(AttachmentID)..BK3=?$expand=microsoft.graph.itemAttachment/item

    Result:

    {
        "error": {
            "code": "ErrorInternalServerError",
            "message": "An internal server error occurred. The operation failed., Index was outside the bounds of the array."
        }
    }
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.