0

I have an Outlook add-in which is using the office.js API for a Taskpane application. I am trying to allow the user to send a new email with an attachment, where the attachment is the email that they are currently viewing. I can create a new window and populate the main properties (to, subject, body, etc...), however, when I use the code below, the attachments are not added to the new email. It looks like I need to use an "item" attachment and give it the "itemId" of the current message, but I have also tried using a "file" attachment with various working URLs. Both attachment types fail to add any attachment, and no errors are shown in the browser debug console. I am using the following code, which I have found in the documentation and other SO questions, but does not seem to work in web browsers or Outlook for Mac:

Office.context.mailbox.displayNewMessageForm({
    toRecipients: ["test@user.com"],
    subject: "Test Subject",
    htmlBody: 'Test Body ',
    attachments :
          [
              { type: "item", itemId : Office.context.mailbox.item.itemId, name: "test_email.msg" }
          ],
          options : { asyncContext: null },
          callback : function (asyncResult)
          {
              if (asyncResult.status == "failed")
              {
                  showMessage("Action failed with error: " + asyncResult.error.message);
              }
          }
});

The window that opens is shown below. It has populated the main properties but does not have the attachment.

Any ideas on what I may be doing incorrectly?

enter image description here

user2023116
  • 423
  • 2
  • 6
  • 16
  • 1
    We are able to repro this issue in OWA and we have added this to our backlog. However, we do not have a repro in Outlook Mac, Could you please provide the following information? 1. Outlook version: 2. Is the issue occurring in Classic Mac UI or New Mac UI? 3. On which surface is the Taskpane running? – Outlook Add-ins Team - MSFT Feb 03 '21 at 04:40
  • My mistake. I guess the app on my mac that I was using is not "Outlook for Mac." It is called Outlook but is different from Outlook for Mac. I downloaded Outlook for Mac and it is working as expected. I'm not sure what the other Outlook application is that is not working, as the "About Outlook" menu item is greyed out. @OutlookAdd-insTeam-MSFT, do you have a link to where I can follow the progress of the bug fix? – user2023116 Feb 03 '21 at 16:11
  • We will update this thread once the fix is available. Thanks for confirming that the issue does not exist in Mac Platform. – Outlook Add-ins Team - MSFT Feb 04 '21 at 05:32
  • @OutlookAdd-insTeam-MSFT It looks like this may be fixed now. Do you show it as having been resolved on your end? – user2023116 Mar 10 '21 at 17:36

0 Answers0