如何解决““ code”:“ RequestBodyRead”“错误?

时间:2019-06-06 22:23:32

标签: javascript ajax microsoft-graph outlook-addin outlook-web-addins

我正在尝试制作一个Outlook加载项,该加载项使用Microsoft API转发电子邮件,但是根据文档,我收到一条错误消息,指出“ comment”不是有效参数。 我正在关注转发文档: here

var forwardMessage = Office.context.mailbox.restUrl +
  '/beta/me/messages/' + itemId + '/forward';
var body= JSON.stringify({
      "comment": item,
      "toRecipients": [
        {
          "emailAddress": {
            "address": "email@email.com",
            "name": "name"
          }
        }
      ]
    })
    $.ajax({
      url: forwardMessage,
      method:"POST",
      dataType: 'json',
    headers: { 'Authorization': 'Bearer ' + accessToken,
  'Content-Type': "application/json" },
  data: body
    }).then(
      console.log("done")
    )
  }).catch(function(error){
    throw error;
  });

错误:

{"error":{"code":"RequestBodyRead","message":"The parameter 'comment' in the request payload is not a valid parameter for the operation 'Forward'."}}

0 个答案:

没有答案