post: reply
- 项目
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
回复帖子,并向组对话中的指定线程添加新帖子。
可以在请求中同时指定父对话和线程,或者仅指定父线程,而不指定父对话。
此 API 可用于以下国家级云部署。
全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
权限
要调用此 API,需要以下权限之一。 若要了解详细信息,包括如何选择权限的信息,请参阅权限。
权限类型 | 权限(从最低特权到最高特权) |
---|---|
委派(工作或学校帐户) | Group.ReadWrite.All |
委派(个人 Microsoft 帐户) | 不支持。 |
应用程序 | Group.ReadWrite.All |
HTTP 请求
POST /groups/{id}/threads/{id}/posts/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/reply
请求标头
标头 | 值 |
---|---|
Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数 | 类型 | 说明 |
---|---|---|
帖子 | 帖子 | 正在回复的新帖子。 |
响应
如果成功,此方法返回 202 Accepted
响应代码。 它不返回响应正文。
示例
下面是一个如何调用此 API 的示例。
请求
以下示例显示了一个请求。
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);
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
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"\
}\
]\
}\
}\
'
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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)
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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);
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
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);
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?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();
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
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
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# 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)
重要
Microsoft Graph SDK 默认使用 v1.0 版本的 API,并且不支持 beta 版本中提供的所有类型、属性和 API。 有关使用 SDK 访问 beta API 的详细信息,请参阅将 Microsoft Graph SDK 与 beta API 配合使用。
有关如何将 SDK 添加到项目并 创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
响应
以下示例显示了相应的响应。
HTTP/1.1 202 Accepted
反馈
此页面是否有帮助?