Get attachment

Read the properties and relationships of an attachment, attached to an event, message, or post.

An attachment can be one of the following types:

All these types of attachment resources are derived from the attachment resource.

Prerequisites

One of the following scopes is required to execute this API:

  • If accessing attachments in messages: Mail.Read
  • If accessing attachments in events: Calendars.Read
  • If accessing attachments in group events or posts: Group.Read.All

HTTP request

Attachments for an event in the user's or group's default calendar.

GET /me/events/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/events/{id}/attachments/{id}
GET /groups/{id}/events/{id}/attachments/{id}

GET /me/calendar/{id}/events/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/calendar/events/{id}/attachments/{id}
GET /groups/{id}/calendar/events/{id}/attachments/{id}

Attachments for an event in a calendar belonging to the user's default calendarGroup.

GET /me/calendars/{id}/events/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/calendars/{id}/events/{id}/attachments/{id}

GET /me/calendargroup/calendars/{id}/events/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/calendargroup/calendars/{id}/events/{id}/attachments/{id}

Attachments for an event in a calendar belonging to a user's calendarGroup.

GET /me/calendargroups/{id}/calendars/{id}/events/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/calendargroups/{id}/calendars/{id}/events/{id}/attachments/{id}

Attachments for a message in a user's mailbox.

GET /me/messages/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/messages/{id}/attachments/{id}

Attachments for a message contained in a top level mailFolder in a user's mailbox.

GET /me/mailFolders/{id}/messages/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/attachments/{id}

Attachments for a message contained in a child folder of a mailFolder in a user's mailbox. The example below shows one level of nesting, but a message can be located in a child of a child and so on.

GET /me/mailFolders/{id}/childFolders/{id}/.../messages/{id}/attachments/{id}
GET /users/{id | userPrincipalName}/mailFolders/{id}/childFolders/{id}/messages/{id}/attachments/{id}

Attachments for a post in a thread belonging to a conversation of a group.

GET /groups/{id}/threads/{id}/posts/{id}/attachments/{id}
GET /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/attachments/{id}

Optional query parameters

This method supports the OData Query Parameters to help customize the response.

Request headers

Name Type Description
Authorization string Bearer . Required.

Request body

Do not supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and attachment object in the response body.

Example (file attachment)

Request

Here is an example of the request to get a file attachment on an event.

GET https://graph.microsoft.com/v1.0/me/events/{id}/attachments/{id}
Response

Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 199

{
  "@odata.type": "#microsoft.graph.fileAttachment",
  "contentType": "contentType-value",
  "contentLocation": "contentLocation-value",
  "contentBytes": "contentBytes-value",
  "contentId": "null",
  "lastModifiedDateTime": "2016-01-01T12:00:00Z",
  "id": "id-value",
  "isInline": false,
  "isContactPhoto": false,
  "name": "name-value",
  "size": 99
}

Example (item attachment)

Request

Here is an example of the request to get an item attachment on an event.

GET https://graph.microsoft.com/v1.0/me/events/{id}/attachments/{id}
Response
HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.type": "#microsoft.graph.itemAttachment",
  "lastModifiedDateTime": "datetime-value",
  "name": "name-value",
  "contentType": "contentType-value",
  "size": 99,
  "isInline": true,
  "id": "id-value"
}

Example (reference attachment)

Request

Here is an example of the request to get a reference attachment on an event.

GET https://graph.microsoft.com/v1.0/me/events/{id}/attachments/{id}
Response

Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 215

{
  "@odata.type": "#microsoft.graph.referenceAttachment",
  "contentType": "contentType-value",
  "lastModifiedDateTime": "datetime-value",
  "id": "id-value",
  "isInline": false,
  "name": "name-value",
  "size": 99,
}