Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Ajoutez une pièce jointe lors de la création d’un billet de groupe.
Cette opération limite la taille de la pièce jointe à laquelle vous pouvez ajouter moins de 3 Mo.
Une pièce jointe peut être l’un des types suivants :
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.
Type d’autorisation
Autorisations (de celle qui offre le plus de privilèges à celle qui en offre le moins)
Déléguée (compte professionnel ou scolaire)
Group.ReadWrite.All
Déléguée (compte Microsoft personnel)
Non prise en charge.
Application
Non prise en charge.
Requête HTTP
Inclure une pièce jointe lors de la création d’une publication dans une conversationThread d’un groupe. La spécification de la conversation parente est facultative.
POST /groups/{id}/threads/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/reply
POST https://graph.microsoft.com/beta/groups/1848753d-185d-4c08-a4e4-6ee40521d115/threads/AAQkADJUdfolA==/reply
Content-type: application/json
{
"post": {
"body": {
"contentType": "text",
"content": "Which quarter does that file cover? See my attachment."
},
"attachments": [{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "Another file as attachment",
"contentBytes": "VGhpcyBpcyBhIGZpbGUgdG8gYmUgYXR0YWNoZWQu"
} ]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Groups.Item.Threads.Item.Reply;
using Microsoft.Graph.Beta.Models;
var requestBody = new ReplyPostRequestBody
{
Post = new Post
{
Body = new ItemBody
{
ContentType = BodyType.Text,
Content = "Which quarter does that file cover? See my attachment.",
},
Attachments = new List<Attachment>
{
new FileAttachment
{
OdataType = "#microsoft.graph.fileAttachment",
Name = "Another file as attachment",
ContentBytes = Convert.FromBase64String("VGhpcyBpcyBhIGZpbGUgdG8gYmUgYXR0YWNoZWQu"),
},
},
},
};
// 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}"].Reply.PostAsync(requestBody);
// 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 := "Which quarter does that file cover? See my attachment."
body.SetContent(&content)
post.SetBody(body)
attachment := graphmodels.NewFileAttachment()
name := "Another file as attachment"
attachment.SetName(&name)
contentBytes := []byte("vGhpcyBpcyBhIGZpbGUgdG8gYmUgYXR0YWNoZWQu")
attachment.SetContentBytes(&contentBytes)
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").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.reply.ReplyPostRequestBody replyPostRequestBody = new com.microsoft.graph.beta.groups.item.threads.item.reply.ReplyPostRequestBody();
Post post = new Post();
ItemBody body = new ItemBody();
body.setContentType(BodyType.Text);
body.setContent("Which quarter does that file cover? See my attachment.");
post.setBody(body);
LinkedList<Attachment> attachments = new LinkedList<Attachment>();
FileAttachment attachment = new FileAttachment();
attachment.setOdataType("#microsoft.graph.fileAttachment");
attachment.setName("Another file as attachment");
byte[] contentBytes = Base64.getDecoder().decode("VGhpcyBpcyBhIGZpbGUgdG8gYmUgYXR0YWNoZWQu");
attachment.setContentBytes(contentBytes);
attachments.add(attachment);
post.setAttachments(attachments);
replyPostRequestBody.setPost(post);
graphClient.groups().byGroupId("{group-id}").threads().byConversationThreadId("{conversationThread-id}").reply().post(replyPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\ReplyPostRequestBody;
use Microsoft\Graph\Generated\Models\Post;
use Microsoft\Graph\Generated\Models\ItemBody;
use Microsoft\Graph\Generated\Models\Attachment;
use Microsoft\Graph\Generated\Models\FileAttachment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ReplyPostRequestBody();
$post = new Post();
$postBody = new ItemBody();
$postBody->setContentType(new BodyType('text'));
$postBody->setContent('Which quarter does that file cover? See my attachment.');
$post->setBody($postBody);
$attachmentsAttachment1 = new FileAttachment();
$attachmentsAttachment1->setOdataType('#microsoft.graph.fileAttachment');
$attachmentsAttachment1->setName('Another file as attachment');
$attachmentsAttachment1->setContentBytes(\GuzzleHttp\Psr7\Utils::streamFor(base64_decode('VGhpcyBpcyBhIGZpbGUgdG8gYmUgYXR0YWNoZWQu')));
$attachmentsArray []= $attachmentsAttachment1;
$post->setAttachments($attachmentsArray);
$requestBody->setPost($post);
$graphServiceClient->groups()->byGroupId('group-id')->threads()->byConversationThreadId('conversationThread-id')->reply()->post($requestBody)->wait();
from msgraph import GraphServiceClient
from msgraph.generated.groups.item.threads.item.reply.reply_post_request_body import ReplyPostRequestBody
from msgraph.generated.models.post import Post
from msgraph.generated.models.item_body import ItemBody
from msgraph.generated.models.attachment import Attachment
from msgraph.generated.models.file_attachment import FileAttachment
graph_client = GraphServiceClient(credentials, scopes)
request_body = ReplyPostRequestBody(
post = Post(
body = ItemBody(
content_type = BodyType.Text,
content = "Which quarter does that file cover? See my attachment.",
),
attachments = [
FileAttachment(
odata_type = "#microsoft.graph.fileAttachment",
name = "Another file as attachment",
content_bytes = base64.urlsafe_b64decode("VGhpcyBpcyBhIGZpbGUgdG8gYmUgYXR0YWNoZWQu"),
),
],
),
)
await graph_client.groups.by_group_id('group-id').threads.by_conversation_thread_id('conversationThread-id').reply.post(request_body)
POST https://graph.microsoft.com/beta/groups/1848753d-185d-4c08-a4e4-6ee40521d115/threads/AAQkADJUdfolA==/reply
Content-type: application/json
{
"post": {
"body": {
"contentType": "text",
"content": "I attached an event."
},
"attachments": [{
"@odata.type": "#microsoft.graph.itemAttachment",
"name": "Holiday event",
"item": {
"@odata.type": "microsoft.graph.event",
"subject": "Discuss gifts for children",
"body": {
"contentType": "HTML",
"content": "Let's look for funding!"
},
"start": {
"dateTime": "2019-12-02T18:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2019-12-02T19:00:00",
"timeZone": "Pacific Standard Time"
}
}
} ]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Groups.Item.Threads.Item.Reply;
using Microsoft.Graph.Beta.Models;
var requestBody = new ReplyPostRequestBody
{
Post = new Post
{
Body = new ItemBody
{
ContentType = BodyType.Text,
Content = "I attached an event.",
},
Attachments = new List<Attachment>
{
new ItemAttachment
{
OdataType = "#microsoft.graph.itemAttachment",
Name = "Holiday event",
Item = new Event
{
OdataType = "microsoft.graph.event",
Subject = "Discuss gifts for children",
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Let's look for funding!",
},
Start = new DateTimeTimeZone
{
DateTime = "2019-12-02T18:00:00",
TimeZone = "Pacific Standard Time",
},
End = new DateTimeTimeZone
{
DateTime = "2019-12-02T19:00:00",
TimeZone = "Pacific Standard Time",
},
},
},
},
},
};
// 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}"].Reply.PostAsync(requestBody);
// 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.reply.ReplyPostRequestBody replyPostRequestBody = new com.microsoft.graph.beta.groups.item.threads.item.reply.ReplyPostRequestBody();
Post post = new Post();
ItemBody body = new ItemBody();
body.setContentType(BodyType.Text);
body.setContent("I attached an event.");
post.setBody(body);
LinkedList<Attachment> attachments = new LinkedList<Attachment>();
ItemAttachment attachment = new ItemAttachment();
attachment.setOdataType("#microsoft.graph.itemAttachment");
attachment.setName("Holiday event");
Event item = new Event();
item.setOdataType("microsoft.graph.event");
item.setSubject("Discuss gifts for children");
ItemBody body1 = new ItemBody();
body1.setContentType(BodyType.Html);
body1.setContent("Let's look for funding!");
item.setBody(body1);
DateTimeTimeZone start = new DateTimeTimeZone();
start.setDateTime("2019-12-02T18:00:00");
start.setTimeZone("Pacific Standard Time");
item.setStart(start);
DateTimeTimeZone end = new DateTimeTimeZone();
end.setDateTime("2019-12-02T19:00:00");
end.setTimeZone("Pacific Standard Time");
item.setEnd(end);
attachment.setItem(item);
attachments.add(attachment);
post.setAttachments(attachments);
replyPostRequestBody.setPost(post);
graphClient.groups().byGroupId("{group-id}").threads().byConversationThreadId("{conversationThread-id}").reply().post(replyPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\ReplyPostRequestBody;
use Microsoft\Graph\Generated\Models\Post;
use Microsoft\Graph\Generated\Models\ItemBody;
use Microsoft\Graph\Generated\Models\Attachment;
use Microsoft\Graph\Generated\Models\ItemAttachment;
use Microsoft\Graph\Generated\Models\Event;
use Microsoft\Graph\Generated\Models\DateTimeTimeZone;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ReplyPostRequestBody();
$post = new Post();
$postBody = new ItemBody();
$postBody->setContentType(new BodyType('text'));
$postBody->setContent('I attached an event.');
$post->setBody($postBody);
$attachmentsAttachment1 = new ItemAttachment();
$attachmentsAttachment1->setOdataType('#microsoft.graph.itemAttachment');
$attachmentsAttachment1->setName('Holiday event');
$attachmentsAttachment1Item = new Event();
$attachmentsAttachment1Item->setOdataType('microsoft.graph.event');
$attachmentsAttachment1Item->setSubject('Discuss gifts for children');
$attachmentsAttachment1ItemBody = new ItemBody();
$attachmentsAttachment1ItemBody->setContentType(new BodyType('hTML'));
$attachmentsAttachment1ItemBody->setContent('Let\'s look for funding!');
$attachmentsAttachment1Item->setBody($attachmentsAttachment1ItemBody);
$attachmentsAttachment1ItemStart = new DateTimeTimeZone();
$attachmentsAttachment1ItemStart->setDateTime('2019-12-02T18:00:00');
$attachmentsAttachment1ItemStart->setTimeZone('Pacific Standard Time');
$attachmentsAttachment1Item->setStart($attachmentsAttachment1ItemStart);
$attachmentsAttachment1ItemEnd = new DateTimeTimeZone();
$attachmentsAttachment1ItemEnd->setDateTime('2019-12-02T19:00:00');
$attachmentsAttachment1ItemEnd->setTimeZone('Pacific Standard Time');
$attachmentsAttachment1Item->setEnd($attachmentsAttachment1ItemEnd);
$attachmentsAttachment1->setItem($attachmentsAttachment1Item);
$attachmentsArray []= $attachmentsAttachment1;
$post->setAttachments($attachmentsArray);
$requestBody->setPost($post);
$graphServiceClient->groups()->byGroupId('group-id')->threads()->byConversationThreadId('conversationThread-id')->reply()->post($requestBody)->wait();
L’exemple suivant montre une demande qui inclut une pièce jointe de référence lors de la création d’une publication.
La pièce jointe pointe vers un dossier sur OneDrive.
POST https://graph.microsoft.com/beta/groups/1848753d-185d-4c08-a4e4-6ee40521d115/threads/AAQkADJUdfolA==/reply
Content-type: application/json
{
"post": {
"body": {
"contentType": "text",
"content": "I attached a reference to a file on OneDrive."
},
"attachments": [{
"@odata.type": "#microsoft.graph.referenceAttachment",
"name": "Personal pictures",
"sourceUrl": "https://contoso.com/personal/mario_contoso_net/Documents/Pics",
"providerType": "oneDriveConsumer",
"permission": "Edit",
"isFolder": "True"
} ]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Groups.Item.Threads.Item.Reply;
using Microsoft.Graph.Beta.Models;
var requestBody = new ReplyPostRequestBody
{
Post = new Post
{
Body = new ItemBody
{
ContentType = BodyType.Text,
Content = "I attached a reference to a file on OneDrive.",
},
Attachments = new List<Attachment>
{
new ReferenceAttachment
{
OdataType = "#microsoft.graph.referenceAttachment",
Name = "Personal pictures",
SourceUrl = "https://contoso.com/personal/mario_contoso_net/Documents/Pics",
ProviderType = ReferenceAttachmentProvider.OneDriveConsumer,
Permission = ReferenceAttachmentPermission.Edit,
IsFolder = true,
},
},
},
};
// 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}"].Reply.PostAsync(requestBody);
// 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 := "I attached a reference to a file on OneDrive."
body.SetContent(&content)
post.SetBody(body)
attachment := graphmodels.NewReferenceAttachment()
name := "Personal pictures"
attachment.SetName(&name)
sourceUrl := "https://contoso.com/personal/mario_contoso_net/Documents/Pics"
attachment.SetSourceUrl(&sourceUrl)
providerType := graphmodels.ONEDRIVECONSUMER_REFERENCEATTACHMENTPROVIDER
attachment.SetProviderType(&providerType)
permission := graphmodels.EDIT_REFERENCEATTACHMENTPERMISSION
attachment.SetPermission(&permission)
isFolder := true
attachment.SetIsFolder(&isFolder)
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").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.reply.ReplyPostRequestBody replyPostRequestBody = new com.microsoft.graph.beta.groups.item.threads.item.reply.ReplyPostRequestBody();
Post post = new Post();
ItemBody body = new ItemBody();
body.setContentType(BodyType.Text);
body.setContent("I attached a reference to a file on OneDrive.");
post.setBody(body);
LinkedList<Attachment> attachments = new LinkedList<Attachment>();
ReferenceAttachment attachment = new ReferenceAttachment();
attachment.setOdataType("#microsoft.graph.referenceAttachment");
attachment.setName("Personal pictures");
attachment.setSourceUrl("https://contoso.com/personal/mario_contoso_net/Documents/Pics");
attachment.setProviderType(ReferenceAttachmentProvider.OneDriveConsumer);
attachment.setPermission(ReferenceAttachmentPermission.Edit);
attachment.setIsFolder(true);
attachments.add(attachment);
post.setAttachments(attachments);
replyPostRequestBody.setPost(post);
graphClient.groups().byGroupId("{group-id}").threads().byConversationThreadId("{conversationThread-id}").reply().post(replyPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\ReplyPostRequestBody;
use Microsoft\Graph\Generated\Models\Post;
use Microsoft\Graph\Generated\Models\ItemBody;
use Microsoft\Graph\Generated\Models\Attachment;
use Microsoft\Graph\Generated\Models\ReferenceAttachment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ReplyPostRequestBody();
$post = new Post();
$postBody = new ItemBody();
$postBody->setContentType(new BodyType('text'));
$postBody->setContent('I attached a reference to a file on OneDrive.');
$post->setBody($postBody);
$attachmentsAttachment1 = new ReferenceAttachment();
$attachmentsAttachment1->setOdataType('#microsoft.graph.referenceAttachment');
$attachmentsAttachment1->setName('Personal pictures');
$attachmentsAttachment1->setSourceUrl('https://contoso.com/personal/mario_contoso_net/Documents/Pics');
$attachmentsAttachment1->setProviderType(new ReferenceAttachmentProvider('oneDriveConsumer'));
$attachmentsAttachment1->setPermission(new ReferenceAttachmentPermission('edit'));
$attachmentsAttachment1->setIsFolder(true);
$attachmentsArray []= $attachmentsAttachment1;
$post->setAttachments($attachmentsArray);
$requestBody->setPost($post);
$graphServiceClient->groups()->byGroupId('group-id')->threads()->byConversationThreadId('conversationThread-id')->reply()->post($requestBody)->wait();
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez https://aka.ms/ContentUserFeedback.