Add attachment
- Article
Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Add an attachment when creating a group post.
This operation limits the size of the attachment you can add to under 3 MB.
An attachment can be one of the following types:
- A file (fileAttachment resource).
- An item (contact, event or message, represented by an itemAttachment resource).
- A link to a file (referenceAttachment resource).
All these types of attachment resources are derived from the attachment resource.
This API is available in the following national cloud deployments.
Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Group.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. |
Application | Not supported. |
HTTP request
Include an attachment when creating a post in a conversationThread of a group. Specifying the parent conversation is optional.
POST /groups/{id}/threads/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/reply
Request headers
Header | Value |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Request body
In the request body, provide a JSON object that includes a post parameter.
Parameter | Type | Description |
---|---|---|
post | post | The new post that is being replied with, which includes one or more attachments in an attachment collection. |
Response
If successful, this method returns 202 Accepted
response code. It does not return a response body.
Examples
Example 1: Include a file attachment
Request
The following example shows a request that includes a file as an attachment when creating a post.
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://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Groups["{group-id}"].Threads["{conversationThread-id}"].Reply.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc-beta groups threads reply post --group-id {group-id} --conversation-thread-id {conversationThread-id} --body '{\
"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"\
} ]\
}\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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://zcusa.951200.xyz/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)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const reply = {
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'
} ]
}
};
await client.api('/groups/1848753d-185d-4c08-a4e4-6ee40521d115/threads/AAQkADJUdfolA==/reply')
.version('beta')
.post(reply);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Groups\Item\Threads\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\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('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();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Beta.Groups
$params = @{
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"
}
)
}
}
Invoke-MgBetaReplyGroupThread -GroupId $groupId -ConversationThreadId $conversationThreadId -BodyParameter $params
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# 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.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.attachment import Attachment
from msgraph_beta.generated.models.file_attachment import FileAttachment
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
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)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
HTTP/1.1 202 Accpted
Example 2: Include an item attachment
Request
The following example shows a request that includes an event as an attachment when creating a post.
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://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Groups["{group-id}"].Threads["{conversationThread-id}"].Reply.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc-beta groups threads reply post --group-id {group-id} --conversation-thread-id {conversationThread-id} --body '{\
"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"\
}\
}\
} ]\
}\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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 an event."
body.SetContent(&content)
post.SetBody(body)
attachment := graphmodels.NewItemAttachment()
name := "Holiday event"
attachment.SetName(&name)
item := graphmodels.NewEvent()
subject := "Discuss gifts for children"
item.SetSubject(&subject)
body := graphmodels.NewItemBody()
contentType := graphmodels.HTML_BODYTYPE
body.SetContentType(&contentType)
content := "Let's look for funding!"
body.SetContent(&content)
item.SetBody(body)
start := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-12-02T18:00:00"
start.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
start.SetTimeZone(&timeZone)
item.SetStart(start)
end := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-12-02T19:00:00"
end.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
end.SetTimeZone(&timeZone)
item.SetEnd(end)
attachment.SetItem(item)
attachments := []graphmodels.Attachmentable {
attachment,
}
post.SetAttachments(attachments)
requestBody.SetPost(post)
// To initialize your graphClient, see https://zcusa.951200.xyz/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)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const reply = {
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'
}
}
} ]
}
};
await client.api('/groups/1848753d-185d-4c08-a4e4-6ee40521d115/threads/AAQkADJUdfolA==/reply')
.version('beta')
.post(reply);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Groups\Item\Threads\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\Attachment;
use Microsoft\Graph\Beta\Generated\Models\ItemAttachment;
use Microsoft\Graph\Beta\Generated\Models\Event;
use Microsoft\Graph\Beta\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();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Beta.Groups
$params = @{
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"
}
}
}
)
}
}
Invoke-MgBetaReplyGroupThread -GroupId $groupId -ConversationThreadId $conversationThreadId -BodyParameter $params
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# 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.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.attachment import Attachment
from msgraph_beta.generated.models.item_attachment import ItemAttachment
from msgraph_beta.generated.models.event import Event
from msgraph_beta.generated.models.date_time_time_zone import DateTimeTimeZone
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ReplyPostRequestBody(
post = Post(
body = ItemBody(
content_type = BodyType.Text,
content = "I attached an event.",
),
attachments = [
ItemAttachment(
odata_type = "#microsoft.graph.itemAttachment",
name = "Holiday event",
item = Event(
odata_type = "microsoft.graph.event",
subject = "Discuss gifts for children",
body = ItemBody(
content_type = BodyType.Html,
content = "Let's look for funding!",
),
start = DateTimeTimeZone(
date_time = "2019-12-02T18:00:00",
time_zone = "Pacific Standard Time",
),
end = DateTimeTimeZone(
date_time = "2019-12-02T19:00:00",
time_zone = "Pacific Standard Time",
),
),
),
],
),
)
await graph_client.groups.by_group_id('group-id').threads.by_conversation_thread_id('conversationThread-id').reply.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
HTTP/1.1 202 Accepted
Example 3: Include a reference attachment
Request
The following example shows a request that includes a reference attachment when creating a post. The attachment points to a folder on 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://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Groups["{group-id}"].Threads["{conversationThread-id}"].Reply.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc-beta groups threads reply post --group-id {group-id} --conversation-thread-id {conversationThread-id} --body '{\
"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"\
} ]\
}\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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://zcusa.951200.xyz/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)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const reply = {
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'
} ]
}
};
await client.api('/groups/1848753d-185d-4c08-a4e4-6ee40521d115/threads/AAQkADJUdfolA==/reply')
.version('beta')
.post(reply);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Groups\Item\Threads\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\Attachment;
use Microsoft\Graph\Beta\Generated\Models\ReferenceAttachment;
use Microsoft\Graph\Beta\Generated\Models\ReferenceAttachmentProvider;
use Microsoft\Graph\Beta\Generated\Models\ReferenceAttachmentPermission;
$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();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Beta.Groups
$params = @{
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"
}
)
}
}
Invoke-MgBetaReplyGroupThread -GroupId $groupId -ConversationThreadId $conversationThreadId -BodyParameter $params
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# 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.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.attachment import Attachment
from msgraph_beta.generated.models.reference_attachment import ReferenceAttachment
from msgraph_beta.generated.models.reference_attachment_provider import ReferenceAttachmentProvider
from msgraph_beta.generated.models.reference_attachment_permission import ReferenceAttachmentPermission
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ReplyPostRequestBody(
post = Post(
body = ItemBody(
content_type = BodyType.Text,
content = "I attached a reference to a file on OneDrive.",
),
attachments = [
ReferenceAttachment(
odata_type = "#microsoft.graph.referenceAttachment",
name = "Personal pictures",
source_url = "https://contoso.com/personal/mario_contoso_net/Documents/Pics",
provider_type = ReferenceAttachmentProvider.OneDriveConsumer,
permission = ReferenceAttachmentPermission.Edit,
is_folder = True,
),
],
),
)
await graph_client.groups.by_group_id('group-id').threads.by_conversation_thread_id('conversationThread-id').reply.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
HTTP/1.1 202 Accpted
Feedback
Was this page helpful?