如何使用Office JS外接程序API转发电子邮件? [英] How to forward an email using Office JS Add-in API?

查看:87
本文介绍了如何使用Office JS外接程序API转发电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Office 365 Javascript API for Outlook开发外接程序.我正在使用Microsoft的参考寻找当我单击按钮时允许我转发当前打开的电子邮件的方法.问题是引用上没有一个方法可以做到这一点,我如何使用Office JS 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?

我想应该是这样的:

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

推荐答案

没有用于转发Office.js中包含的当前电子邮件的方法.

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

一个替代解决方案是为此使用Microsoft Graph.您需要使用

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.

一旦有了令牌和消息的id,就可以调用Microsoft Graph /forward端点:

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"
      }
    }
  ]
}

这篇关于如何使用Office JS外接程序API转发电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆