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.
Create a new conversation by including a thread and a post.
POST https://graph.microsoft.com/beta/groups/29981b6a-0e57-42dc-94c9-cd24f5306196/conversations
Content-type: application/json
{
"topic":"New head count",
"threads":[
{
"posts":[
{
"body":{
"contentType":"html",
"content":"The confirmation will come by the end of the week."
},
"newParticipants":[
{
"emailAddress":{
"name":"Adele Vance",
"address":"AdeleV@contoso.onmicrosoft.com"
}
}
]
}
]
}
]
}
const options = {
authProvider,
};
const client = Client.init(options);
const conversation = {
topic: 'New head count',
threads: [
{
posts: [
{
body: {
contentType: 'html',
content: 'The confirmation will come by the end of the week.'
},
newParticipants: [
{
emailAddress: {
name: 'Adele Vance',
address: 'AdeleV@contoso.onmicrosoft.com'
}
}
]
}
]
}
]
};
await client.api('/groups/29981b6a-0e57-42dc-94c9-cd24f5306196/conversations')
.version('beta')
.post(conversation);
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.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Conversation conversation = new Conversation();
conversation.topic = "New head count";
LinkedList<ConversationThread> threadsList = new LinkedList<ConversationThread>();
ConversationThread threads = new ConversationThread();
LinkedList<Post> postsList = new LinkedList<Post>();
Post posts = new Post();
ItemBody body = new ItemBody();
body.contentType = BodyType.HTML;
body.content = "The confirmation will come by the end of the week.";
posts.body = body;
LinkedList<Recipient> newParticipantsList = new LinkedList<Recipient>();
Recipient newParticipants = new Recipient();
EmailAddress emailAddress = new EmailAddress();
emailAddress.name = "Adele Vance";
emailAddress.address = "AdeleV@contoso.onmicrosoft.com";
newParticipants.emailAddress = emailAddress;
newParticipantsList.add(newParticipants);
posts.newParticipants = newParticipantsList;
postsList.add(posts);
PostCollectionResponse postCollectionResponse = new PostCollectionResponse();
postCollectionResponse.value = postsList;
PostCollectionPage postCollectionPage = new PostCollectionPage(postCollectionResponse, null);
threads.posts = postCollectionPage;
threadsList.add(threads);
ConversationThreadCollectionResponse conversationThreadCollectionResponse = new ConversationThreadCollectionResponse();
conversationThreadCollectionResponse.value = threadsList;
ConversationThreadCollectionPage conversationThreadCollectionPage = new ConversationThreadCollectionPage(conversationThreadCollectionResponse, null);
conversation.threads = conversationThreadCollectionPage;
graphClient.groups("29981b6a-0e57-42dc-94c9-cd24f5306196").conversations()
.buildRequest()
.post(conversation);
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.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := graphmodels.NewConversation()
topic := "New head count"
requestBody.SetTopic(&topic)
conversationThread := graphmodels.NewConversationThread()
post := graphmodels.NewPost()
body := graphmodels.NewItemBody()
contentType := graphmodels.HTML_BODYTYPE
body.SetContentType(&contentType)
content := "The confirmation will come by the end of the week."
body.SetContent(&content)
post.SetBody(body)
recipient := graphmodels.NewRecipient()
additionalData := map[string]interface{}{
emailAddress := graphmodels.New()
name := "Adele Vance"
emailAddress.SetName(&name)
address := "AdeleV@contoso.onmicrosoft.com"
emailAddress.SetAddress(&address)
recipient.SetEmailAddress(emailAddress)
}
recipient.SetAdditionalData(additionalData)
newParticipants := []graphmodels.Recipientable {
recipient,
}
post.SetNewParticipants(newParticipants)
posts := []graphmodels.Postable {
post,
}
conversationThread.SetPosts(posts)
threads := []graphmodels.ConversationThreadable {
conversationThread,
}
requestBody.SetThreads(threads)
result, err := graphClient.GroupsById("group-id").Conversations().Post(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.
Import-Module Microsoft.Graph.Groups
$params = @{
Topic = "New head count"
Threads = @(
@{
Posts = @(
@{
Body = @{
ContentType = "html"
Content = "The confirmation will come by the end of the week."
}
NewParticipants = @(
@{
EmailAddress = @{
Name = "Adele Vance"
Address = "AdeleV@contoso.onmicrosoft.com"
}
}
)
}
)
}
)
}
New-MgGroupConversation -GroupId $groupId -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.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Conversation();
$requestBody->setTopic('New head count');
$threadsConversationThread1 = new ConversationThread();
$postsPost1 = new Post();
$postsPost1Body = new ItemBody();
$postsPost1Body->setContentType(new BodyType('html'));
$postsPost1Body->setContent('The confirmation will come by the end of the week.');
$postsPost1->setBody($postsPost1Body);
$newParticipantsRecipient1 = new Recipient();
$additionalData = [
'emailAddress' => $newParticipantsRecipient1 = new EmailAddress();
$ newParticipantsRecipient1->setName('Adele Vance');
$ newParticipantsRecipient1->setAddress('AdeleV@contoso.onmicrosoft.com');
$newParticipantsRecipient1->setEmailAddress($emailAddress);
];
$newParticipantsRecipient1->setAdditionalData($additionalData);
$newParticipantsArray []= $newParticipantsRecipient1;
$postsPost1->setNewParticipants($newParticipantsArray);
$postsArray []= $postsPost1;
$threadsConversationThread1->setPosts($postsArray);
$threadsArray []= $threadsConversationThread1;
$requestBody->setThreads($threadsArray);
$requestResult = $graphServiceClient->groupsById('group-id')->conversations()->post($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.