fileAttachment resource type

Namespace: microsoft.graph

A file (such as a text file or Word document) attached to a user event, message, 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.


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


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


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 Don't use this property as it isn't supported.
contentType String The content type of the attachment.
id String The attachment ID.
isInline Boolean Set to true if the attachment 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 and doesn't need to be the actual file name.
size Int32 The size in bytes of the attachment.



JSON representation

The following JSON representation shows the resource type.

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