Επεξεργασία

Κοινή χρήση μέσω


Create conversation

Namespace: microsoft.graph Create a new conversation by including a thread and a post.

Use reply thread or reply post to further post to that conversation.

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

POST /groups/{id}/conversations

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json

Request body

In the request body, supply a JSON representation of conversation object containing a conversationThread and a post.

Response

If successful, this method returns 201 Created response code and conversation object in the response body.

The response includes the IDs for the new conversation and thread, which you can use in the list posts operation to get the new post as well.

Example

Request

The following example shows a request.

POST https://graph.microsoft.com/v1.0/groups/29981b6a-0e57-42dc-94c9-cd24f5306196/conversations
Content-type: application/json

{
    "topic": "Take your wellness days and rest",
    "threads": [
        {
            "posts": [
                {
                    "body": {
                        "contentType": "html",
                        "content": "Contoso cares about you: Rest and Recharge"
                    },
                    "newParticipants": [
                        {
                            "emailAddress": {
                                "name": "Adele Vance",
                                "address": "AdeleV@contoso.com"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups('4d81ce71-486c-41e9-afc5-e41bf2d0722a')/conversations/$entity",
    "id": "AAQkAGRhZmRhMWM3LTYwZTktNDZmYy1hNWU1LThhZWU4NzI2YTEyZgAQADamkjVbzvRKnUq1oBRdwhk=",
    "threads": [
        {
            "id": "AAQkAGRhZmRhMWM3LTYwZTktNDZmYy1hNWU1LThhZWU4NzI2YTEyZgMkABAANqaSNVvO9EqdSrWgFF3CGRAANqaSNVvO9EqdSrWgFF3CGQ=="
        }
    ]
}