Can I access the Office.context.mailbox.item.attachment in Outlook web add-in and send it to a external server? RRS feed

  • Question

  • Office.context.mailbox.item.attachments.

    According to the doc I know it is a Array of AttachmentDetails.

    And the AttachmentDetails consists of some members.

    But can I actually get access to the content of the attachment and be able to send it somewhere?

    Like I want to send a pdf from a message and send it to my server.

    Thursday, August 9, 2018 6:25 AM


  • Hi Frostless,

    I think you can use the attachments API to send information about the attachments to the remote service. 

    Office JS code snippet:

    function getAttachmentToken() {
        if (serviceRequest.attachmentToken == "") {
    function attachmentTokenCallback(asyncResult, userContext) {
        if (asyncResult.status === "succeeded") {
            // Cache the result from the server.
            serviceRequest.attachmentToken = asyncResult.value;
            serviceRequest.state = 3;
        } else {
            showToast("Error", "Could not get callback token: " + asyncResult.error.message);
    // Initialize a context object for the add-in.
    //   Set the fields that are used on the request
    //   object to default values.
     var serviceRequest = {
        attachmentToken: '',
        ewsUrl         : Office.context.mailbox.ewsUrl,
        attachments    : []

    For more information, please see Using the attachments API .



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    • Marked as answer by Frostless Thursday, August 9, 2018 11:31 PM
    Thursday, August 9, 2018 9:00 AM