创建对话Create conversation

命名空间: microsoft. graph 通过包含线程和帖子创建新的 对话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.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限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.AllGroup.ReadWrite.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application 不支持。Not supported.

HTTP 请求HTTP request

POST /groups/{id}/conversations

请求标头Request headers

标头Header Value
AuthorizationAuthorization Bearer {token}。必需。Bearer {token}. Required.
Content-TypeContent-Type application/jsonapplication/json

请求正文Request body

在请求正文中,提供包括 conversationThread帖子conversation 对象的 JSON 表示形式。In the request body, supply a JSON representation of conversation object containing a conversationThread and a post.

响应Response

如果成功,此方法在响应正文中返回 201 Created 响应代码和 conversation 对象。If successful, this method returns 201 Created response code and conversation object in the response body.

响应包括新对话和线程的 ID,这些 ID 也可用于列出帖子操作,从而获取新帖子。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 is an example of the request.

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

{
    "topic":"New locations for this quarter",
    "threads":[
        {
            "posts":[
                {
                    "body":{
                        "contentType":"html",
                        "content":"What do we know so far?"
                    },
                    "newParticipants":[
                        {
                            "emailAddress":{
                                "name":"Adele Vance",
                                "address":"AdeleV@contoso.onmicrosoft.com"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

响应Response

下面展示了示例响应。The following is an example of the response.

注意: 为了提高可读性,可能缩短了此处显示的响应对象。所有属性都将通过实际调用返回。Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.

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

{
    "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups('29981b6a-0e57-42dc-94c9-cd24f5306196')/conversations/$entity",
    "id":"AAQkADDVKtMlRp4Txc6k=",
    "threads@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups('29981b6a-0e57-42dc-94c9-cd24f5306196')/conversations('AAQkADDVKtMlRp4Txc6k%3D')/threads",
    "threads":[
        {
            "id":"AAQkADQDarUNUq0yVGnhPFzqQ=="
        }
    ]
}