post: reply
Artikel
07/18/2022
5 Minuten Lesedauer
3 Mitwirkende
In diesem Artikel
Namespace: microsoft.graph
Dient zum Antworten auf einen Beitrag und zum Hinzufügen eines neuen Beitrags zum angegebenen Thread in einer Gruppenunterhaltung.
Sie können sowohl die übergeordnete Unterhaltung als auch den Thread in der Anforderung angeben, oder Sie können nur den übergeordneten Thread ohne die übergeordnete Unterhaltung angeben.
Berechtigungen
Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen .
Berechtigungstyp
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)
Delegiert (Geschäfts-, Schul- oder Unikonto)
Group.ReadWrite.All
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Anwendung
Group.ReadWrite.All
HTTP-Anforderung
POST /groups/{id}/threads/{id}/posts/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/reply
Kopfzeile
Wert
Authorization
Bearer {token}. Erforderlich.
Anforderungstext
Geben Sie im Anforderungstext ein JSON-Objekt mit den folgenden Parametern an.
Parameter
Typ
Beschreibung
Beitrag
post
Der neue Beitrag, mit dem geantwortet wird.
Antwort
Wenn die Methode erfolgreich verläuft, wird der Antwortcode 202 Accepted zurückgegeben. Im Antworttext wird nichts zurückgegeben.
Beispiel
Nachfolgend sehen Sie ein Beispiel dafür, wie diese API aufgerufen wird.
Anforderung
Nachfolgend sehen Sie ein Beispiel der Anforderung.
POST https://graph.microsoft.com/v1.0/groups/{id}/threads/{id}/posts/{id}/reply
Content-type: application/json
{
"post": {
"body": {
"contentType": "",
"content": "content-value"
},
"receivedDateTime": "datetime-value",
"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": "datetime-value",
"lastModifiedDateTime": "datetime-value",
"changeKey": "changeKey-value",
"categories": [
"categories-value"
],
"id": "id-value",
"inReplyTo": {
},
"attachments": [
{
"@odata.type": "#microsoft.graph.fileAttachment",
"lastModifiedDateTime": "datetime-value",
"name": "name-value",
"contentType": "contentType-value",
"size": 99,
"isInline": true,
"id": "id-value"
}
]
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var post = new Post
{
Body = new ItemBody
{
ContentType = BodyType.Text,
Content = "content-value"
},
ReceivedDateTime = DateTimeOffset.Parse("datetime-value"),
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("datetime-value"),
LastModifiedDateTime = DateTimeOffset.Parse("datetime-value"),
ChangeKey = "changeKey-value",
Categories = new List<String>()
{
"categories-value"
},
Id = "id-value",
InReplyTo = new Post
{
},
Attachments = new PostAttachmentsCollectionPage()
{
new FileAttachment
{
LastModifiedDateTime = DateTimeOffset.Parse("datetime-value"),
Name = "name-value",
ContentType = "contentType-value",
Size = 99,
IsInline = true,
Id = "id-value"
}
}
};
await graphClient.Groups["{group-id}"].Threads["{conversationThread-id}"].Posts["{post-id}"]
.Reply(post)
.Request()
.PostAsync();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
const options = {
authProvider,
};
const client = Client.init(options);
const reply = {
post: {
body: {
contentType: '',
content: 'content-value'
},
receivedDateTime: 'datetime-value',
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: 'datetime-value',
lastModifiedDateTime: 'datetime-value',
changeKey: 'changeKey-value',
categories: [
'categories-value'
],
id: 'id-value',
inReplyTo: {
},
attachments: [
{
'@odata.type': '#microsoft.graph.fileAttachment',
lastModifiedDateTime: 'datetime-value',
name: 'name-value',
contentType: 'contentType-value',
size: 99,
isInline: true,
id: 'id-value'
}
]
}
};
await client.api('/groups/{id}/threads/{id}/posts/{id}/reply')
.post(reply);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Post post = new Post();
ItemBody body = new ItemBody();
body.contentType = BodyType.TEXT;
body.content = "content-value";
post.body = body;
post.receivedDateTime = OffsetDateTimeSerializer.deserialize("datetime-value");
post.hasAttachments = true;
Recipient from = new Recipient();
EmailAddress emailAddress = new EmailAddress();
emailAddress.name = "name-value";
emailAddress.address = "address-value";
from.emailAddress = emailAddress;
post.from = from;
Recipient sender = new Recipient();
EmailAddress emailAddress1 = new EmailAddress();
emailAddress1.name = "name-value";
emailAddress1.address = "address-value";
sender.emailAddress = emailAddress1;
post.sender = sender;
post.conversationThreadId = "conversationThreadId-value";
LinkedList<Recipient> newParticipantsList = new LinkedList<Recipient>();
Recipient newParticipants = new Recipient();
EmailAddress emailAddress2 = new EmailAddress();
emailAddress2.name = "name-value";
emailAddress2.address = "address-value";
newParticipants.emailAddress = emailAddress2;
newParticipantsList.add(newParticipants);
post.newParticipants = newParticipantsList;
post.conversationId = "conversationId-value";
post.createdDateTime = OffsetDateTimeSerializer.deserialize("datetime-value");
post.lastModifiedDateTime = OffsetDateTimeSerializer.deserialize("datetime-value");
post.changeKey = "changeKey-value";
LinkedList<String> categoriesList = new LinkedList<String>();
categoriesList.add("categories-value");
post.categories = categoriesList;
post.id = "id-value";
Post inReplyTo = new Post();
post.inReplyTo = inReplyTo;
LinkedList<Attachment> attachmentsList = new LinkedList<Attachment>();
FileAttachment attachments = new FileAttachment();
attachments.lastModifiedDateTime = OffsetDateTimeSerializer.deserialize("datetime-value");
attachments.name = "name-value";
attachments.contentType = "contentType-value";
attachments.size = 99;
attachments.isInline = true;
attachments.id = "id-value";
attachmentsList.add(attachments);
AttachmentCollectionResponse attachmentCollectionResponse = new AttachmentCollectionResponse();
attachmentCollectionResponse.value = attachmentsList;
AttachmentCollectionPage attachmentCollectionPage = new AttachmentCollectionPage(attachmentCollectionResponse, null);
post.attachments = attachmentCollectionPage;
graphClient.groups("{id}").threads("{id}").posts("{id}")
.reply(PostReplyParameterSet
.newBuilder()
.withPost(post)
.build())
.buildRequest()
.post();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewPostRequestBody()
post := msgraphsdk.NewPost()
requestBody.SetPost(post)
body := msgraphsdk.NewItemBody()
post.SetBody(body)
contentType := ""
body.SetContentType(&contentType)
content := "content-value"
body.SetContent(&content)
receivedDateTime, err := time.Parse(time.RFC3339, "datetime-value")
post.SetReceivedDateTime(&receivedDateTime)
hasAttachments := true
post.SetHasAttachments(&hasAttachments)
from := msgraphsdk.NewRecipient()
post.SetFrom(from)
emailAddress := msgraphsdk.NewEmailAddress()
from.SetEmailAddress(emailAddress)
name := "name-value"
emailAddress.SetName(&name)
address := "address-value"
emailAddress.SetAddress(&address)
sender := msgraphsdk.NewRecipient()
post.SetSender(sender)
emailAddress := msgraphsdk.NewEmailAddress()
sender.SetEmailAddress(emailAddress)
name := "name-value"
emailAddress.SetName(&name)
address := "address-value"
emailAddress.SetAddress(&address)
conversationThreadId := "conversationThreadId-value"
post.SetConversationThreadId(&conversationThreadId)
post.SetNewParticipants( []Recipient {
msgraphsdk.NewRecipient(),
SetAdditionalData(map[string]interface{}{
}
}
conversationId := "conversationId-value"
post.SetConversationId(&conversationId)
createdDateTime, err := time.Parse(time.RFC3339, "datetime-value")
post.SetCreatedDateTime(&createdDateTime)
lastModifiedDateTime, err := time.Parse(time.RFC3339, "datetime-value")
post.SetLastModifiedDateTime(&lastModifiedDateTime)
changeKey := "changeKey-value"
post.SetChangeKey(&changeKey)
post.SetCategories( []String {
"categories-value",
}
id := "id-value"
post.SetId(&id)
inReplyTo := msgraphsdk.NewPost()
post.SetInReplyTo(inReplyTo)
post.SetAttachments( []Attachment {
msgraphsdk.NewAttachment(),
lastModifiedDateTime, err := time.Parse(time.RFC3339, "datetime-value")
SetLastModifiedDateTime(&lastModifiedDateTime)
name := "name-value"
SetName(&name)
contentType := "contentType-value"
SetContentType(&contentType)
size := int32(99)
SetSize(&size)
isInline := true
SetIsInline(&isInline)
id := "id-value"
SetId(&id)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.fileAttachment",
}
}
groupId := "group-id"
conversationThreadId := "conversationThread-id"
postId := "post-id"
graphClient.GroupsById(&groupId).ThreadsById(&conversationThreadId).PostsById(&postId).Reply(group-id, conversationThread-id, post-id).Post(requestBody)
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Import-Module Microsoft.Graph.Groups
$params = @{
Post = @{
Body = @{
ContentType = ""
Content = "content-value"
}
ReceivedDateTime = [System.DateTime]::Parse("datetime-value")
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("datetime-value")
LastModifiedDateTime = [System.DateTime]::Parse("datetime-value")
ChangeKey = "changeKey-value"
Categories = @(
"categories-value"
)
Id = "id-value"
InReplyTo = @{
}
Attachments = @(
@{
"@odata.type" = "#microsoft.graph.fileAttachment"
LastModifiedDateTime = [System.DateTime]::Parse("datetime-value")
Name = "name-value"
ContentType = "contentType-value"
Size = 99
IsInline = $true
Id = "id-value"
}
)
}
}
Invoke-MgReplyGroupThreadPost -GroupId $groupId -ConversationThreadId $conversationThreadId -PostId $postId -BodyParameter $params
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Antwort
Nachfolgend sehen Sie ein Beispiel der Antwort.
HTTP/1.1 202 Accepted