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

Caution

Existing apps that use this feature with Outlook tasks should be updated, as Outlook tasks are being deprecated. See To Do APIs in public preview for more information.

A file (such as a text file or Word document) attached to a user event, message, Outlook task, or post.

When creating a file attachment, include the following in the request body:

  • "@odata.type": "#microsoft.graph.fileAttachment"
  • The required properties name and contentBytes.

Derived from attachment.

Note

Make sure to encode the file content in base64 before assigning it to contentBytes.

Methods

Method Return Type Description
Get fileAttachment Read the properties, relationships, or raw contents of a fileAttachment object.
Delete None Delete a fileAttachment object.

Properties

Property Type Description
contentBytes Edm.Binary The base64-encoded contents of the file.
contentId String The ID of the attachment in the Exchange store.
contentLocation String Do not use this property as it is not supported.
contentType String The content type of the attachment.
id String The attachment ID.
isInline Boolean Set to true if this is an inline attachment.
lastModifiedDateTime DateTimeOffset The date and time when the attachment was last modified.
name String The name representing the text that is displayed below the icon representing the embedded attachment.This does not need to be the actual file name.
size Int32 The size in bytes of the attachment.

Relationships

None.

JSON representation

The following is a JSON representation of the resource.

{
  "contentBytes": "string (binary)",
  "contentId": "string",
  "contentLocation": "string",
  "contentType": "string",
  "id": "string (identifier)",
  "isInline": true,
  "lastModifiedDateTime": "String (timestamp)",
  "name": "string",
  "size": "Int32"
}