Redigera

Dela via


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

Outlook tasks is deprecated and stopped returning data on August 10, 2022. Update existing apps that use this feature with Outlook tasks.

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 attachment fileAttachment Read the properties, relationships, or raw contents of a fileAttachment object.
Delete attachment 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 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 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 doesn't need to be the actual file name.
size Int32 The size in bytes of the attachment.

Relationships

None.

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"
}