post: reply post: reply
22.09.2020
2 Minuten Lesedauer
In diesem Artikel
Namespace: microsoft.graph Namespace: microsoft.graph
Dient zum Antworten auf einen Beitrag und zum Hinzufügen eines neuen Beitrags zum angegebenen Thread in einer Gruppenunterhaltung. Reply to a post and add a new post to the specified thread in a group conversation.
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. You can specify both the parent conversation and thread in the request, or, you can specify just the parent thread without the parent conversation.
Berechtigungen Permissions
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 . One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Berechtigungstyp Permission type
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten) Permissions (from least to most privileged)
Delegiert (Geschäfts-, Schul- oder Unikonto) Delegated (work or school account)
Group.ReadWrite.All Group.ReadWrite.All
Delegiert (persönliches Microsoft-Konto) Delegated (personal Microsoft account)
Nicht unterstützt Not supported.
Anwendung Application
Group.ReadWrite.All Group.ReadWrite.All
HTTP-Anforderung HTTP request
POST /groups/{id}/threads/{id}/posts/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/reply
Kopfzeile Header
Wert Value
Authorization Authorization
Bearer {token}. Erforderlich. Bearer {token}. Required.
Anforderungstext Request body
Geben Sie im Anforderungstext ein JSON-Objekt mit den folgenden Parametern an. In the request body, provide a JSON object with the following parameters.
Parameter Parameter
Typ Type
Beschreibung Description
Beitrag post
post post
Der neue Beitrag, mit dem geantwortet wird. The new post that is being replied with.
Antwort Response
Wenn die Methode erfolgreich verläuft, wird der Antwortcode 202 Accepted
zurückgegeben. Im Antworttext wird nichts zurückgegeben. If successful, this method returns 202 Accepted
response code. It does not return anything in the response body.
Beispiel Example
Nachfolgend sehen Sie ein Beispiel dafür, wie diese API aufgerufen wird. Here is an example of how to call this API.
Anforderung Request
Nachfolgend sehen Sie ein Beispiel der Anforderung. Here is an example of the request.
POST https://graph.microsoft.com/v1.0/groups/{id}/threads/{id}/posts/{id}/reply
Content-type: application/json
Content-length: 1131
{
"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": [
{
"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 = (IPostAttachmentsCollectionPage)new List<Attachment>()
{
new Attachment
{
LastModifiedDateTime = DateTimeOffset.Parse("datetime-value"),
Name = "name-value",
ContentType = "contentType-value",
Size = 99,
IsInline = true,
Id = "id-value"
}
}
};
await graphClient.Groups["{id}"].Threads["{id}"].Posts["{id}"]
.Reply(post)
.Request()
.PostAsync();
In der SDK-Dokumentation finden Sie Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider -Instanz. Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
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: [
{
lastModifiedDateTime: "datetime-value",
name: "name-value",
contentType: "contentType-value",
size: 99,
isInline: true,
id: "id-value"
}
]
}
};
let res = await client.api('/groups/{id}/threads/{id}/posts/{id}/reply')
.post(reply);
In der SDK-Dokumentation finden Sie Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider -Instanz. Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient 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 = CalendarSerializer.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 = CalendarSerializer.deserialize("datetime-value");
post.lastModifiedDateTime = CalendarSerializer.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>();
Attachment attachments = new Attachment();
attachments.lastModifiedDateTime = CalendarSerializer.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(post)
.buildRequest()
.post();
In der SDK-Dokumentation finden Sie Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider -Instanz. Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Antwort Response
Nachfolgend sehen Sie ein Beispiel der Antwort. Here is an example of the response.
HTTP/1.1 202 Accepted