attachment resource type
Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
The base type for several types of attachments on a user, message, task, or group post that serves as the base resource for the following derived types of attachments:
- A file (fileAttachment resource)
- An item (contact, event, or message, represented by an itemAttachment resource)
- A link to a file (referenceAttachment resource)
You can add related content to a user event, message, Outlook task, or group post in the form of an attachment.
Caution
Outlook tasks is deprecated and stopped returning data on August 10, 2022. Update existing apps that use this feature with Outlook tasks.
Events in group calendars do not support attachments.
Outlook tasks do not support reference attachments.
Note: If you're attaching a file to a group post, or attaching an item to an event, message, or group post, limit the size of the attachment to 3 MB.
If you're attaching a file under 3 MB, you can add the file attachment to a user event, to a message, or to a group post.
If you're attaching a file between 3 MB and 150 MB to an event or message, you can create an upload session and iteratively upload ranges of the file to attach it. See attach large files to Outlook messages for an example.
Methods
The following methods apply to any of the derived types of attachments (fileAttachment, itemAttachment, or referenceAttachment).
Method | Return Type | Description |
---|---|---|
Get attachment | attachment | Read the properties, relationships, or raw contents of an attachment, attached to a user event, message, Outlook task, or post. |
Add attachment to a user event | attachment | Add a file, item, or link attachment to an event in a user calendar. This operation limits the size of the attachment you can add to under 3 MB. |
Add attachment to a message | attachment | Add a file, item, or link attachment to a message. This operation limits the size of the attachment you can add to under 3 MB. |
Create session to attach large file | uploadSession | Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified message or event. The file size must be between 3 MB and 150 MB. |
Add attachment to an Outlook task (deprecated) | attachment | Add a file or item attachment to an Outlook task. |
Add attachment to a post | attachment | Add a file, item, or link attachment to a group post. This operation limits the size of the attachment you can add to under 3 MB. |
List attachments of a user event | attachment collection | Get a list of attachments for an event in a user calendar. |
List attachments of a message | attachment collection | Get a list of attachments for a message. |
List attachments of an Outlook task (deprecated) | attachment collection | Get a list of attachments for an Outlook task. |
List attachments of a post | attachment collection | Get a list of attachments for a post. |
Delete | None | Delete an attachment on an event, message, Outlook task, or post. |
Properties
The following are the base properties of any attachment resource. Refer to the specific type of attachment (fileAttachment, itemAttachment, or referenceAttachment) for additional properties.
Property | Type | Description |
---|---|---|
contentType | String | The MIME type. |
id | String | Read-only. |
isInline | Boolean | true if the attachment is an inline attachment; otherwise, false . |
lastModifiedDateTime | DateTimeOffset | The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z |
name | String | The display name of the attachment. This does not need to be the actual file name. |
size | Int32 | The length of the attachment in bytes. |
Relationships
None
JSON representation
The following JSON representation shows the resource type.
{
"contentType": "string",
"id": "string (identifier)",
"isInline": true,
"lastModifiedDateTime": "String (timestamp)",
"name": "string",
"size": 1024
}