使用PHP中的Microsoft Graph更新电子邮件的主题

问题描述 投票:1回答:1

这是我目前的代码:

require_once '/pathtovendor/vendor/autoload.php';

use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
use Microsoft\Graph\Http\GraphRequest;

$access_token = "My valid access token";

$graph = new Graph();
$graph->setAccessToken($access_token);

$reply = array( "Comment" => "My reply" );
$message_id = "Valid message ID";

if($graph->createRequest("POST", "/me/messages/".$message_id."/reply")
      ->attachBody($reply)
      ->execute()){
        // I can get to this part OK. Message is replied to.

    //This code doesn't work
    $graph->createRequest("PATCH", "/me/messages/".$message_id)
      ->attachBody(array( "Subject" => "New Subject" ))
      ->execute();
}

我可以运行GETPOST请求工作,但我不能让PATCH以这种方式工作。它继续抛出500 Internal Server Error。任何帮助表示赞赏。

php microsoft-graph outlook-restapi
1个回答
1
投票

仅在草稿消息上支持此功能。来自documentation

subject |字符串|消息的主题。仅当isDraft = true时才可更新。

以下属性只能在草稿消息中更新:

  • bccRecipients
  • body
  • ccRecipients
  • internetMessageId
  • replyTo
  • sender
  • subject
  • toRecipients
  • from
© www.soinside.com 2019 - 2024. All rights reserved.