Export (0) Print
Expand All

Appointment.addItemAttachmentAsync method (JavaScript API for Office v1.1)

Adds an Exchange item, such as a message, as an attachment to the appointment. This function was introduced in version 1.1.

Last modified: September 25, 2014

Applicable Outlook modes

Compose

Available in requirement sets

Mailbox

Office.context.mailbox.item.addItemAttachmentAsync(itemId, attachmentName[, options], callback);

itemId

The Exchange identifier of the item to attach. The maximum length is 100 characters. Required.

attachmentName

The subject of the item to be attached. The maximum length is 255 characters. Required.

options

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

callback

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

The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the appointment in the compose form. If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the callback method, if needed.

You can subsequently use the attachment identifier with the removeAttachmentAsync method to remove the attachment in the same session.

If your app for Office is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the appointment that you are editing; however, this is not supported and is not recommended.

If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error.

Error code

Description

NumberOfAttachmentsExceeded

The appointment has too many attachments.

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:
© 2015 Microsoft