Répondre à un billet et ajouter un billet au thread spécifié dans une conversation de groupe.
Vous pouvez spécifier la conversation parent et le thread dans la demande ou spécifier uniquement le thread parent sans la conversation parent.
L’une des autorisations suivantes est nécessaire pour appeler cette API. Pour plus d’informations, notamment sur la façon de choisir les autorisations, voir Autorisations.
Dans le corps de la demande, indiquez un objet JSON avec les paramètres suivants.
Voici comment vous pouvez appeler cette API.
L’exemple suivant illustre une demande.
POST https://graph.microsoft.com/beta/groups/{id}/threads/{id}/posts/{id}/reply
Content-type: application/json
{
"post": {
"body": {
"contentType": "",
"content": "content-value"
},
"receivedDateTime": "2016-10-19T10:37:00Z",
"hasAttachments": true,
"from": {
"emailAddress": {
"name": "name-value",
"address": "address-value"
}
},
"sender": {
"emailAddress": {
"name": "name-value",
"address": "address-value"
}
},
"conversationThreadId": "conversationThreadId-value",
"newParticipants": [
{
"emailAddress": {
"name": "name-value",
"address": "address-value"
}
}
],
"conversationId": "conversationId-value",
"createdDateTime": "2016-10-19T10:37:00Z",
"lastModifiedDateTime": "2016-10-19T10:37:00Z",
"changeKey": "changeKey-value",
"categories": [
"categories-value"
],
"id": "id-value",
"inReplyTo": {
},
"attachments": [
{
"@odata.type": "#microsoft.graph.fileAttachment",
"lastModifiedDateTime": "2016-10-19T10:37:00Z",
"name": "name-value",
"contentType": "contentType-value",
"size": 99,
"isInline": true,
"id": "id-value"
}
]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Groups.Item.Threads.Item.Posts.Item.Reply;
using Microsoft.Graph.Beta.Models;
var requestBody = new ReplyPostRequestBody
{
Post = new Post
{
Body = new ItemBody
{
ContentType = BodyType.Text,
Content = "content-value",
},
ReceivedDateTime = DateTimeOffset.Parse("2016-10-19T10:37:00Z"),
HasAttachments = true,
From = new Recipient
{
EmailAddress = new EmailAddress
{
Name = "name-value",
Address = "address-value",
},
},
Sender = new Recipient
{
EmailAddress = new EmailAddress
{
Name = "name-value",
Address = "address-value",
},
},
ConversationThreadId = "conversationThreadId-value",
NewParticipants = new List<Recipient>
{
new Recipient
{
EmailAddress = new EmailAddress
{
Name = "name-value",
Address = "address-value",
},
},
},
ConversationId = "conversationId-value",
CreatedDateTime = DateTimeOffset.Parse("2016-10-19T10:37:00Z"),
LastModifiedDateTime = DateTimeOffset.Parse("2016-10-19T10:37:00Z"),
ChangeKey = "changeKey-value",
Categories = new List<string>
{
"categories-value",
},
Id = "id-value",
InReplyTo = new Post
{
},
Attachments = new List<Attachment>
{
new FileAttachment
{
OdataType = "#microsoft.graph.fileAttachment",
LastModifiedDateTime = DateTimeOffset.Parse("2016-10-19T10:37:00Z"),
Name = "name-value",
ContentType = "contentType-value",
Size = 99,
IsInline = true,
Id = "id-value",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Groups["{group-id}"].Threads["{conversationThread-id}"].Posts["{post-id}"].Reply.PostAsync(requestBody);
mgc-beta groups threads posts reply post --group-id {group-id} --conversation-thread-id {conversationThread-id} --post-id {post-id} --body '{\
"post": {\
"body": {\
"contentType": "",\
"content": "content-value"\
},\
"receivedDateTime": "2016-10-19T10:37:00Z",\
"hasAttachments": true,\
"from": {\
"emailAddress": {\
"name": "name-value",\
"address": "address-value"\
}\
},\
"sender": {\
"emailAddress": {\
"name": "name-value",\
"address": "address-value"\
}\
},\
"conversationThreadId": "conversationThreadId-value",\
"newParticipants": [\
{\
"emailAddress": {\
"name": "name-value",\
"address": "address-value"\
}\
}\
],\
"conversationId": "conversationId-value",\
"createdDateTime": "2016-10-19T10:37:00Z",\
"lastModifiedDateTime": "2016-10-19T10:37:00Z",\
"changeKey": "changeKey-value",\
"categories": [\
"categories-value"\
],\
"id": "id-value",\
"inReplyTo": {\
},\
"attachments": [\
{\
"@odata.type": "#microsoft.graph.fileAttachment",\
"lastModifiedDateTime": "2016-10-19T10:37:00Z",\
"name": "name-value",\
"contentType": "contentType-value",\
"size": 99,\
"isInline": true,\
"id": "id-value"\
}\
]\
}\
}\
'
// 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"
graphgroups "github.com/microsoftgraph/msgraph-beta-sdk-go/groups"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphgroups.NewReplyPostRequestBody()
post := graphmodels.NewPost()
body := graphmodels.NewItemBody()
contentType := graphmodels.TEXT_BODYTYPE
body.SetContentType(&contentType)
content := "content-value"
body.SetContent(&content)
post.SetBody(body)
receivedDateTime , err := time.Parse(time.RFC3339, "2016-10-19T10:37:00Z")
post.SetReceivedDateTime(&receivedDateTime)
hasAttachments := true
post.SetHasAttachments(&hasAttachments)
from := graphmodels.NewRecipient()
emailAddress := graphmodels.NewEmailAddress()
name := "name-value"
emailAddress.SetName(&name)
address := "address-value"
emailAddress.SetAddress(&address)
from.SetEmailAddress(emailAddress)
post.SetFrom(from)
sender := graphmodels.NewRecipient()
emailAddress := graphmodels.NewEmailAddress()
name := "name-value"
emailAddress.SetName(&name)
address := "address-value"
emailAddress.SetAddress(&address)
sender.SetEmailAddress(emailAddress)
post.SetSender(sender)
conversationThreadId := "conversationThreadId-value"
post.SetConversationThreadId(&conversationThreadId)
recipient := graphmodels.NewRecipient()
emailAddress := graphmodels.NewEmailAddress()
name := "name-value"
emailAddress.SetName(&name)
address := "address-value"
emailAddress.SetAddress(&address)
recipient.SetEmailAddress(emailAddress)
newParticipants := []graphmodels.Recipientable {
recipient,
}
post.SetNewParticipants(newParticipants)
conversationId := "conversationId-value"
post.SetConversationId(&conversationId)
createdDateTime , err := time.Parse(time.RFC3339, "2016-10-19T10:37:00Z")
post.SetCreatedDateTime(&createdDateTime)
lastModifiedDateTime , err := time.Parse(time.RFC3339, "2016-10-19T10:37:00Z")
post.SetLastModifiedDateTime(&lastModifiedDateTime)
changeKey := "changeKey-value"
post.SetChangeKey(&changeKey)
categories := []string {
"categories-value",
}
post.SetCategories(categories)
id := "id-value"
post.SetId(&id)
inReplyTo := graphmodels.NewPost()
post.SetInReplyTo(inReplyTo)
attachment := graphmodels.NewFileAttachment()
lastModifiedDateTime , err := time.Parse(time.RFC3339, "2016-10-19T10:37:00Z")
attachment.SetLastModifiedDateTime(&lastModifiedDateTime)
name := "name-value"
attachment.SetName(&name)
contentType := "contentType-value"
attachment.SetContentType(&contentType)
size := int32(99)
attachment.SetSize(&size)
isInline := true
attachment.SetIsInline(&isInline)
id := "id-value"
attachment.SetId(&id)
attachments := []graphmodels.Attachmentable {
attachment,
}
post.SetAttachments(attachments)
requestBody.SetPost(post)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Groups().ByGroupId("group-id").Threads().ByConversationThreadId("conversationThread-id").Posts().ByPostId("post-id").Reply().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.groups.item.threads.item.posts.item.reply.ReplyPostRequestBody replyPostRequestBody = new com.microsoft.graph.beta.groups.item.threads.item.posts.item.reply.ReplyPostRequestBody();
Post post = new Post();
ItemBody body = new ItemBody();
body.setContentType(BodyType.Text);
body.setContent("content-value");
post.setBody(body);
OffsetDateTime receivedDateTime = OffsetDateTime.parse("2016-10-19T10:37:00Z");
post.setReceivedDateTime(receivedDateTime);
post.setHasAttachments(true);
Recipient from = new Recipient();
EmailAddress emailAddress = new EmailAddress();
emailAddress.setName("name-value");
emailAddress.setAddress("address-value");
from.setEmailAddress(emailAddress);
post.setFrom(from);
Recipient sender = new Recipient();
EmailAddress emailAddress1 = new EmailAddress();
emailAddress1.setName("name-value");
emailAddress1.setAddress("address-value");
sender.setEmailAddress(emailAddress1);
post.setSender(sender);
post.setConversationThreadId("conversationThreadId-value");
LinkedList<Recipient> newParticipants = new LinkedList<Recipient>();
Recipient recipient = new Recipient();
EmailAddress emailAddress2 = new EmailAddress();
emailAddress2.setName("name-value");
emailAddress2.setAddress("address-value");
recipient.setEmailAddress(emailAddress2);
newParticipants.add(recipient);
post.setNewParticipants(newParticipants);
post.setConversationId("conversationId-value");
OffsetDateTime createdDateTime = OffsetDateTime.parse("2016-10-19T10:37:00Z");
post.setCreatedDateTime(createdDateTime);
OffsetDateTime lastModifiedDateTime = OffsetDateTime.parse("2016-10-19T10:37:00Z");
post.setLastModifiedDateTime(lastModifiedDateTime);
post.setChangeKey("changeKey-value");
LinkedList<String> categories = new LinkedList<String>();
categories.add("categories-value");
post.setCategories(categories);
post.setId("id-value");
Post inReplyTo = new Post();
post.setInReplyTo(inReplyTo);
LinkedList<Attachment> attachments = new LinkedList<Attachment>();
FileAttachment attachment = new FileAttachment();
attachment.setOdataType("#microsoft.graph.fileAttachment");
OffsetDateTime lastModifiedDateTime1 = OffsetDateTime.parse("2016-10-19T10:37:00Z");
attachment.setLastModifiedDateTime(lastModifiedDateTime1);
attachment.setName("name-value");
attachment.setContentType("contentType-value");
attachment.setSize(99);
attachment.setIsInline(true);
attachment.setId("id-value");
attachments.add(attachment);
post.setAttachments(attachments);
replyPostRequestBody.setPost(post);
graphClient.groups().byGroupId("{group-id}").threads().byConversationThreadId("{conversationThread-id}").posts().byPostId("{post-id}").reply().post(replyPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const reply = {
post: {
body: {
contentType: '',
content: 'content-value'
},
receivedDateTime: '2016-10-19T10:37:00Z',
hasAttachments: true,
from: {
emailAddress: {
name: 'name-value',
address: 'address-value'
}
},
sender: {
emailAddress: {
name: 'name-value',
address: 'address-value'
}
},
conversationThreadId: 'conversationThreadId-value',
newParticipants: [
{
emailAddress: {
name: 'name-value',
address: 'address-value'
}
}
],
conversationId: 'conversationId-value',
createdDateTime: '2016-10-19T10:37:00Z',
lastModifiedDateTime: '2016-10-19T10:37:00Z',
changeKey: 'changeKey-value',
categories: [
'categories-value'
],
id: 'id-value',
inReplyTo: {
},
attachments: [
{
'@odata.type': '#microsoft.graph.fileAttachment',
lastModifiedDateTime: '2016-10-19T10:37:00Z',
name: 'name-value',
contentType: 'contentType-value',
size: 99,
isInline: true,
id: 'id-value'
}
]
}
};
await client.api('/groups/{id}/threads/{id}/posts/{id}/reply')
.version('beta')
.post(reply);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Groups\Item\Threads\Item\Posts\Item\Reply\ReplyPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Post;
use Microsoft\Graph\Beta\Generated\Models\ItemBody;
use Microsoft\Graph\Beta\Generated\Models\BodyType;
use Microsoft\Graph\Beta\Generated\Models\Recipient;
use Microsoft\Graph\Beta\Generated\Models\EmailAddress;
use Microsoft\Graph\Beta\Generated\Models\Attachment;
use Microsoft\Graph\Beta\Generated\Models\FileAttachment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ReplyPostRequestBody();
$post = new Post();
$postBody = new ItemBody();
$postBody->setContentType(new BodyType('text'));
$postBody->setContent('content-value');
$post->setBody($postBody);
$post->setReceivedDateTime(new \DateTime('2016-10-19T10:37:00Z'));
$post->setHasAttachments(true);
$postFrom = new Recipient();
$postFromEmailAddress = new EmailAddress();
$postFromEmailAddress->setName('name-value');
$postFromEmailAddress->setAddress('address-value');
$postFrom->setEmailAddress($postFromEmailAddress);
$post->setFrom($postFrom);
$postSender = new Recipient();
$postSenderEmailAddress = new EmailAddress();
$postSenderEmailAddress->setName('name-value');
$postSenderEmailAddress->setAddress('address-value');
$postSender->setEmailAddress($postSenderEmailAddress);
$post->setSender($postSender);
$post->setConversationThreadId('conversationThreadId-value');
$newParticipantsRecipient1 = new Recipient();
$newParticipantsRecipient1EmailAddress = new EmailAddress();
$newParticipantsRecipient1EmailAddress->setName('name-value');
$newParticipantsRecipient1EmailAddress->setAddress('address-value');
$newParticipantsRecipient1->setEmailAddress($newParticipantsRecipient1EmailAddress);
$newParticipantsArray []= $newParticipantsRecipient1;
$post->setNewParticipants($newParticipantsArray);
$post->setConversationId('conversationId-value');
$post->setCreatedDateTime(new \DateTime('2016-10-19T10:37:00Z'));
$post->setLastModifiedDateTime(new \DateTime('2016-10-19T10:37:00Z'));
$post->setChangeKey('changeKey-value');
$post->setCategories(['categories-value', ]);
$post->setId('id-value');
$postInReplyTo = new Post();
$post->setInReplyTo($postInReplyTo);
$attachmentsAttachment1 = new FileAttachment();
$attachmentsAttachment1->setOdataType('#microsoft.graph.fileAttachment');
$attachmentsAttachment1->setLastModifiedDateTime(new \DateTime('2016-10-19T10:37:00Z'));
$attachmentsAttachment1->setName('name-value');
$attachmentsAttachment1->setContentType('contentType-value');
$attachmentsAttachment1->setSize(99);
$attachmentsAttachment1->setIsInline(true);
$attachmentsAttachment1->setId('id-value');
$attachmentsArray []= $attachmentsAttachment1;
$post->setAttachments($attachmentsArray);
$requestBody->setPost($post);
$graphServiceClient->groups()->byGroupId('group-id')->threads()->byConversationThreadId('conversationThread-id')->posts()->byPostId('post-id')->reply()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Groups
$params = @{
post = @{
body = @{
contentType = ""
content = "content-value"
}
receivedDateTime = [System.DateTime]::Parse("2016-10-19T10:37:00Z")
hasAttachments = $true
from = @{
emailAddress = @{
name = "name-value"
address = "address-value"
}
}
sender = @{
emailAddress = @{
name = "name-value"
address = "address-value"
}
}
conversationThreadId = "conversationThreadId-value"
newParticipants = @(
@{
emailAddress = @{
name = "name-value"
address = "address-value"
}
}
)
conversationId = "conversationId-value"
createdDateTime = [System.DateTime]::Parse("2016-10-19T10:37:00Z")
lastModifiedDateTime = [System.DateTime]::Parse("2016-10-19T10:37:00Z")
changeKey = "changeKey-value"
categories = @(
"categories-value"
)
id = "id-value"
inReplyTo = @{
}
attachments = @(
@{
"@odata.type" = "#microsoft.graph.fileAttachment"
lastModifiedDateTime = [System.DateTime]::Parse("2016-10-19T10:37:00Z")
name = "name-value"
contentType = "contentType-value"
size = 99
isInline = $true
id = "id-value"
}
)
}
}
Invoke-MgBetaReplyGroupThreadPost -GroupId $groupId -ConversationThreadId $conversationThreadId -PostId $postId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.groups.item.threads.item.posts.item.reply.reply_post_request_body import ReplyPostRequestBody
from msgraph_beta.generated.models.post import Post
from msgraph_beta.generated.models.item_body import ItemBody
from msgraph_beta.generated.models.body_type import BodyType
from msgraph_beta.generated.models.recipient import Recipient
from msgraph_beta.generated.models.email_address import EmailAddress
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 = ReplyPostRequestBody(
post = Post(
body = ItemBody(
content_type = BodyType.Text,
content = "content-value",
),
received_date_time = "2016-10-19T10:37:00Z",
has_attachments = True,
from = Recipient(
email_address = EmailAddress(
name = "name-value",
address = "address-value",
),
),
sender = Recipient(
email_address = EmailAddress(
name = "name-value",
address = "address-value",
),
),
conversation_thread_id = "conversationThreadId-value",
new_participants = [
Recipient(
email_address = EmailAddress(
name = "name-value",
address = "address-value",
),
),
],
conversation_id = "conversationId-value",
created_date_time = "2016-10-19T10:37:00Z",
last_modified_date_time = "2016-10-19T10:37:00Z",
change_key = "changeKey-value",
categories = [
"categories-value",
],
id = "id-value",
in_reply_to = Post(
),
attachments = [
FileAttachment(
odata_type = "#microsoft.graph.fileAttachment",
last_modified_date_time = "2016-10-19T10:37:00Z",
name = "name-value",
content_type = "contentType-value",
size = 99,
is_inline = True,
id = "id-value",
),
],
),
)
await graph_client.groups.by_group_id('group-id').threads.by_conversation_thread_id('conversationThread-id').posts.by_post_id('post-id').reply.post(request_body)
L’exemple suivant illustre la réponse.