Message.removeAttachmentAsync method (JavaScript API for Office v1.1)

JavaScript API for Office v1.1

Removes an attachment from a message. This method was introduced in version 1.1.

Last modified: June 26, 2014

Applicable Outlook modes

Compose

Available in requirement sets

Mailbox

Office.context.mailbox.item.removeAttachmentAsync(attachmentIndex[, options], callback);

attachmentIndex

The index of the attachment to remove. The maximum length of the string is 100 characters.

options

Any optional parameters or state data passed to the method. Optional.

callback

The method to invoke when the attachment finishes uploading. Optional.

The removeAttachmentAsync method removes the attachment with the specified index from the message. As a best practice, you should use the attachment index to remove an attachment only if the same mail app has added that attachment in the same session. In Outlook Web App and OWA for Devices, the attachment index is valid only within the same session. A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form to continue in a separate window.

If you specify a callback method, the method is called with one parameter, asyncResult, which contains a code that indicates any error that occurred while uploading the attachment.

Error code

Description

InvalidAttachmentId

The attachment index does not exist.

App types

Mail app

Supported clients

Outlook 2013 SP1, Outlook 2013 RT, Outlook Web App, and OWA for Devices

Library

Office.js

Namespace

Office

Show:
© 2014 Microsoft