APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Reply to all recipients of a message using either JSON or MIME format.
When using JSON format:
Specify either a comment or the body property of the message parameter. Specifying both will return an HTTP 400 Bad Request error.
If the original message specifies a recipient in the replyTo property, per Internet Message Format (RFC 2822), send the reply to the recipients in replyTo and not the recipient in the from property.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
Mail.Send
Not available.
Delegated (personal Microsoft account)
Mail.Send
Not available.
Application
Mail.Send
Not available.
HTTP request
POST /users/me/messages/{id}/replyAll
POST /users/{id | userPrincipalName}/messages/{id}/replyAll
POST /me/mailFolders/{id}/messages/{id}/replyAll
POST /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/replyAll
Request headers
Name
Type
Description
Authorization
string
Bearer {token}. Required
Content-Type
string
Nature of the data in the body of an entity. Required Use application/json for a JSON object and text/plain for MIME content
Prefer: outlook.timezone
string
Sets the time zone for the Sent field of the reply message in HTML that this API creates based on the request body. The value can be any of the supportedTimeZones configured for the user. If not specified, that Sent field is in UTC.
Use this header only if you're specifying the Content-Type: application/json header to create the reply message in HTML. If you use the Content-Type: text/plain header, this Prefer header does not have any effect. Optional.
Request body
When using JSON format, provide a JSON object with the following parameters.
Any writeable properties to update in the reply message.
When specifying the body in MIME format, provide the MIME content with the applicable Internet message headers, all encoded in base64 format in the request body. This method loads the sender and all recipients of the original message as recipients of the new message.
Response
If successful, this method returns 202 Accepted response code. It doesn't return anything in the response body.
If the request body includes malformed MIME content, this method returns 400 Bad request and the following error message: "Invalid base64 string for MIME content".
Examples
Example 1: Reply-all to a message in JSON format
The following example includes a comment and adds an attachment to the reply-all message.
POST https://graph.microsoft.com/beta/me/messages/AAMkADA1MTAAAH5JaKAAA=/replyAll
Content-Type: application/json
{
"message":{
"attachments": [
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "guidelines.txt",
"contentBytes": "bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
]
},
"comment": "Please take a look at the attached guidelines before you decide on the name."
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Me.Messages.Item.ReplyAll;
using Microsoft.Graph.Beta.Models;
var requestBody = new ReplyAllPostRequestBody
{
Message = new Message
{
Attachments = new List<Attachment>
{
new FileAttachment
{
OdataType = "#microsoft.graph.fileAttachment",
Name = "guidelines.txt",
ContentBytes = Convert.FromBase64String("bWFjIGFuZCBjaGVlc2UgdG9kYXk="),
},
},
},
Comment = "Please take a look at the attached guidelines before you decide on the name.",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Me.Messages["{message-id}"].ReplyAll.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
mgc-beta users messages reply-all post --user-id {user-id} --message-id {message-id} --body '{\
"message":{\
"attachments": [\
{\
"@odata.type": "#microsoft.graph.fileAttachment",\
"name": "guidelines.txt",\
"contentBytes": "bWFjIGFuZCBjaGVlc2UgdG9kYXk="\
}\
]\
},\
"comment": "Please take a look at the attached guidelines before you decide on the name."\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphusers.NewItemReplyAllPostRequestBody()
message := graphmodels.NewMessage()
attachment := graphmodels.NewFileAttachment()
name := "guidelines.txt"
attachment.SetName(&name)
contentBytes := []byte("bWFjIGFuZCBjaGVlc2UgdG9kYXk=")
attachment.SetContentBytes(&contentBytes)
attachments := []graphmodels.Attachmentable {
attachment,
}
message.SetAttachments(attachments)
requestBody.SetMessage(message)
comment := "Please take a look at the attached guidelines before you decide on the name."
requestBody.SetComment(&comment)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Me().Messages().ByMessageId("message-id").ReplyAll().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.users.item.messages.item.replyall.ReplyAllPostRequestBody replyAllPostRequestBody = new com.microsoft.graph.beta.users.item.messages.item.replyall.ReplyAllPostRequestBody();
Message message = new Message();
LinkedList<Attachment> attachments = new LinkedList<Attachment>();
FileAttachment attachment = new FileAttachment();
attachment.setOdataType("#microsoft.graph.fileAttachment");
attachment.setName("guidelines.txt");
byte[] contentBytes = Base64.getDecoder().decode("bWFjIGFuZCBjaGVlc2UgdG9kYXk=");
attachment.setContentBytes(contentBytes);
attachments.add(attachment);
message.setAttachments(attachments);
replyAllPostRequestBody.setMessage(message);
replyAllPostRequestBody.setComment("Please take a look at the attached guidelines before you decide on the name.");
graphClient.me().messages().byMessageId("{message-id}").replyAll().post(replyAllPostRequestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
const options = {
authProvider,
};
const client = Client.init(options);
const replyAll = {
message: {
attachments: [
{
'@odata.type': '#microsoft.graph.fileAttachment',
name: 'guidelines.txt',
contentBytes: 'bWFjIGFuZCBjaGVlc2UgdG9kYXk='
}
]
},
comment: 'Please take a look at the attached guidelines before you decide on the name.'
};
await client.api('/me/messages/AAMkADA1MTAAAH5JaKAAA=/replyAll')
.version('beta')
.post(replyAll);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Messages\Item\ReplyAll\ReplyAllPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Message;
use Microsoft\Graph\Beta\Generated\Models\Attachment;
use Microsoft\Graph\Beta\Generated\Models\FileAttachment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ReplyAllPostRequestBody();
$message = new Message();
$attachmentsAttachment1 = new FileAttachment();
$attachmentsAttachment1->setOdataType('#microsoft.graph.fileAttachment');
$attachmentsAttachment1->setName('guidelines.txt');
$attachmentsAttachment1->setContentBytes(\GuzzleHttp\Psr7\Utils::streamFor(base64_decode('bWFjIGFuZCBjaGVlc2UgdG9kYXk=')));
$attachmentsArray []= $attachmentsAttachment1;
$message->setAttachments($attachmentsArray);
$requestBody->setMessage($message);
$requestBody->setComment('Please take a look at the attached guidelines before you decide on the name.');
$graphServiceClient->me()->messages()->byMessageId('message-id')->replyAll()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Import-Module Microsoft.Graph.Beta.Users.Actions
$params = @{
message = @{
attachments = @(
@{
"@odata.type" = "#microsoft.graph.fileAttachment"
name = "guidelines.txt"
contentBytes = "bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
)
}
comment = "Please take a look at the attached guidelines before you decide on the name."
}
# A UPN can also be used as -UserId.
Invoke-MgBetaReplyAllUserMessage -UserId $userId -MessageId $messageId -BodyParameter $params
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.users.item.messages.item.reply_all.reply_all_post_request_body import ReplyAllPostRequestBody
from msgraph_beta.generated.models.message import Message
from msgraph_beta.generated.models.attachment import Attachment
from msgraph_beta.generated.models.file_attachment import FileAttachment
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ReplyAllPostRequestBody(
message = Message(
attachments = [
FileAttachment(
odata_type = "#microsoft.graph.fileAttachment",
name = "guidelines.txt",
content_bytes = base64.urlsafe_b64decode("bWFjIGFuZCBjaGVlc2UgdG9kYXk="),
),
],
),
comment = "Please take a look at the attached guidelines before you decide on the name.",
)
await graph_client.me.messages.by_message_id('message-id').reply_all.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.