JChris
JChris

Reputation: 1678

How to forward an email using Office JS Add-in API?

I'm trying to develop an add-in using Office 365 Javascript API for Outlook. I'm using Microsoft's reference to look for methods that will allow me to forward the currently opened email when I click a button. The issue is that there's not a single method on the reference that can do that, how can I forward an email using Office JS API?

I imagine it should be something like that:

var item = Office.context.mailbox.item;  # item represents the currently opened email
item.Forward(email)

Upvotes: 1

Views: 1931

Answers (2)

user7823505
user7823505

Reputation:

Currently the feature you requested is not part of the product.

However, we track Outlook add-in feature requests on our user-voice page. Please add your request there.

Feature requests on user-voice are considered when we go through our planning process.

[Outlook Add-ins Engineering Team]

Upvotes: 0

Marc LaFleur
Marc LaFleur

Reputation: 33114

There isn't a method for forwarding the current email included in Office.js.

One alternative solution would be to use Microsoft Graph for this. You'll need to register an Application ID using the steps outlined in Authenticate a user with an single-sign-on token in an Outlook add-in.

Once you have a token and the message's id, you call into Microsoft Graph /forward endpoint:

POST https://graph.microsoft.com/v1.0/me/messages/{id}/forward
Content-type: application/json

{
  "comment": "",
  "toRecipients": [
    {
      "emailAddress": {
        "name": "recipient-name",
        "address": "recipient-email"
      }
    }
  ]
}

Upvotes: 2

Related Questions