Reputation: 325
Here's my current code:
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();
}
I can run GET
and POST
requests which work, but I can't get PATCH
to work this way. It continues to throw a 500 Internal Server Error
. Any help is appreciated.
Upvotes: 1
Views: 799
Reputation: 33124
This is only supported on draft messages. From the documentation:
subject
| String | The subject of the message. Updatable only if isDraft = true.
The following properties can only be updated in draft messages:
bccRecipients
body
ccRecipients
internetMessageId
replyTo
sender
subject
toRecipients
from
Upvotes: 1