me.message

Add file attachment

Use this API to add a file attachment to a message. An attachment can be one of the following types: fileAttachment, itemAttachment, or referenceAttachment. All these types of attachment resources are derived from the attachment resource. For file attachments smaller than 3 MB, use this endpoint. For larger files, use the createUploadSession endpoint.

post/me/messages/{messageId}/attachments

Request body

@odata.typestring
idstring

The unique identifier for an entity. Read-only

lastModifiedDateTimestring date-time nullable

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

sizenumber

The length of the attachment in bytes

namestring nullable

The attachment's file name

isInlineboolean

true if the attachment is an inline attachment; otherwise, false

contentTypestring nullable

The MIME type

contentBytesstring base64url nullable

The base64-encoded contents of the file attachment. Required only for file attachments

Response

Created attachment

@odata.typestring
idstring

The unique identifier for an entity. Read-only

lastModifiedDateTimestring date-time nullable

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

sizenumber

The length of the attachment in bytes

namestring nullable

The attachment's file name

isInlineboolean

true if the attachment is an inline attachment; otherwise, false

contentTypestring nullable

The MIME type

contentBytesstring base64url nullable

The base64-encoded contents of the file attachment. Required only for file attachments

Changes

Changed in 4 of the 10 revisions of this API.240

    • added the new optional request property allOf[subschema #2: attachment]/contentBytes

      new-optional-request-property

    • added the optional property allOf[subschema #2: attachment]/contentBytes to the response with the 2XX status

      response-optional-property-added

    • api operation id me.messages.CreateAttachments removed and replaced with addAttachment

      api-operation-id-removed

    • mapped value for discriminator key #microsoft.graph.attachment changed from microsoft.graph.attachment to MicrosoftGraphAttachment for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from microsoft.graph.fileAttachment to MicrosoftGraphAttachment for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from microsoft.graph.fileAttachment to MicrosoftGraphAttachment for allOf[subschema #2: attachment]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.itemAttachment changed from microsoft.graph.attachment to MicrosoftGraphAttachment for allOf[subschema #2: attachment]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailFolder changed from microsoft.graph.mailFolder to MicrosoftGraphMailFolder for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailSearchFolder changed from microsoft.graph.mailSearchFolder to MicrosoftGraphMailFolder for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.message changed from microsoft.graph.message to MicrosoftGraphMessage for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.outlookItem changed from microsoft.graph.outlookItem to MicrosoftGraphOutlookItem for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.referenceAttachment changed from microsoft.graph.attachment to MicrosoftGraphAttachment for allOf[subschema #2: attachment]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.attachment changed from microsoft.graph.attachment to MicrosoftGraphAttachment for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from microsoft.graph.fileAttachment to MicrosoftGraphAttachment for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from microsoft.graph.fileAttachment to MicrosoftGraphAttachment for allOf[subschema #2: attachment]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.itemAttachment changed from microsoft.graph.attachment to MicrosoftGraphAttachment for allOf[subschema #2: attachment]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailFolder changed from microsoft.graph.mailFolder to MicrosoftGraphMailFolder for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailSearchFolder changed from microsoft.graph.mailSearchFolder to MicrosoftGraphMailFolder for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.message changed from microsoft.graph.message to MicrosoftGraphMessage for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.outlookItem changed from microsoft.graph.outlookItem to MicrosoftGraphOutlookItem for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.referenceAttachment changed from microsoft.graph.attachment to MicrosoftGraphAttachment for allOf[subschema #2: attachment]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

  • c6fc1d98f528219See the full diff
    • removed the request property allOf[subschema #2: attachment]/contentBytes

      request-property-removed

    • removed the optional property allOf[subschema #2: attachment]/contentBytes from the response with the 2XX status

      response-optional-property-removed

    • api operation id addAttachment removed and replaced with me.messages.CreateAttachments

      api-operation-id-removed

    • mapped value for discriminator key #microsoft.graph.attachment changed from MicrosoftGraphAttachment to microsoft.graph.attachment for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from MicrosoftGraphAttachment to microsoft.graph.fileAttachment for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from MicrosoftGraphAttachment to microsoft.graph.fileAttachment for allOf[subschema #2: attachment]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.itemAttachment changed from MicrosoftGraphAttachment to microsoft.graph.attachment for allOf[subschema #2: attachment]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailFolder changed from MicrosoftGraphMailFolder to microsoft.graph.mailFolder for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailSearchFolder changed from MicrosoftGraphMailFolder to microsoft.graph.mailSearchFolder for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.message changed from MicrosoftGraphMessage to microsoft.graph.message for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.outlookItem changed from MicrosoftGraphOutlookItem to microsoft.graph.outlookItem for allOf[subschema #1: entity]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.referenceAttachment changed from MicrosoftGraphAttachment to microsoft.graph.attachment for allOf[subschema #2: attachment]/ request property

      request-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.attachment changed from MicrosoftGraphAttachment to microsoft.graph.attachment for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from MicrosoftGraphAttachment to microsoft.graph.fileAttachment for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.fileAttachment changed from MicrosoftGraphAttachment to microsoft.graph.fileAttachment for allOf[subschema #2: attachment]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.itemAttachment changed from MicrosoftGraphAttachment to microsoft.graph.attachment for allOf[subschema #2: attachment]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailFolder changed from MicrosoftGraphMailFolder to microsoft.graph.mailFolder for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.mailSearchFolder changed from MicrosoftGraphMailFolder to microsoft.graph.mailSearchFolder for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.message changed from MicrosoftGraphMessage to microsoft.graph.message for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.outlookItem changed from MicrosoftGraphOutlookItem to microsoft.graph.outlookItem for allOf[subschema #1: entity]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed

    • mapped value for discriminator key #microsoft.graph.referenceAttachment changed from MicrosoftGraphAttachment to microsoft.graph.attachment for allOf[subschema #2: attachment]/ response property for the response status 2XX

      response-property-discriminator-mapping-changed