| title | Create channel |
|---|---|
| description | Create new channel in a team, as specified in the request body. |
| ms.localizationpriority | medium |
| author | MSFTRickyCastaneda |
| ms.subservice | teams |
| doc_type | apiPageType |
| ms.date | 09/18/2024 |
Namespace: microsoft.graph
Create a new channel in a team, as specified in the request body. When you create a channel, the maximum length of the channel's displayName is 50 characters. This is the name that appears to the user in Microsoft Teams.
If you're creating a private channel, you can add a maximum of 200 members.
Note
- Some special characters in the channel name cause the Get filesFolder API to return an error. For details, see Known issues.
- When you create a private or shared channel, the SharePoint site might fail to provision. If the site fails to provision after five minutes, use the Get filesFolder API to trigger provisioning.
- You can create shared channels with only one owner initially. Adding multiple owners results in a
400 Bad Requesterror code. After the initial request, you can add more owners using the Add member to channel API. - Shared channel creation isn't supported in Microsoft Graph China (21Vianet).
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
This API supports admin permissions. Microsoft Teams service admins can access teams that they are not a member of.
[!INCLUDE permissions-table]
Note
- The Group.ReadWrite.All and Directory.ReadWrite.All permissions are supported only for backward compatibility. We recommend that you update your solutions to use an alternative permission listed in the previous table and avoid using these permissions going forward.
- The Channel.Create.Group permission uses resource-specific consent. In the future, Microsoft may require you or your customers to pay additional fees based on the amount of data imported using Teamwork.Migrate.All and/or migration APIs.
POST /teams/{team-id}/channels| Header | Value |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
In the request body, supply a JSON representation of channel object.
If successful, this method returns a 201 Created response code and a channel object in the response body for a channel with a membershipType value of standard or private. For a channel with a membershipType value of shared, this method returns a 202 Accepted response code and a link to the teamsAsyncOperation.
The following example shows a request to create a standard channel.
POST https://graph.microsoft.com/v1.0/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels
Content-type: application/json
{
"displayName": "Architecture Discussion",
"description": "This channel is where we debate all future architecture plans",
"membershipType": "standard"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "19:4b6bed8d24574f6a9e436813cb2617d8@thread.tacv2",
"displayName": "Architecture Discussion",
"description": "This channel is where we debate all future architecture plans"
}The following example shows a request to create a private channel and add a user as an team owner.
POST https://graph.microsoft.com/v1.0/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels
Content-type: application/json
{
"@odata.type": "#Microsoft.Graph.channel",
"membershipType": "private",
"displayName": "My First Private Channel",
"description": "This is my first private channels",
"members":
[
{
"@odata.type":"#microsoft.graph.aadUserConversationMember",
"user@odata.bind":"https://graph.microsoft.com/v1.0/users('62855810-484b-4823-9e01-60667f8b12ae')",
"roles":["owner"]
}
]
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
Note: To add a guest account to the channel, for the roles property, use the value
guest.
The following example shows the response.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('57fb72d0-d811-46f4-8947-305e6072eaa5')/channels/$entity",
"id": "19:33b76eea88574bd1969dca37e2b7a819@thread.skype",
"displayName": "My First Private Channel",
"description": "This is my first private channels",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19:33b76eea88574bd1969dca37e2b7a819@thread.skype/My%20First%20Private%20Channel?groupId=57fb72d0-d811-46f4-8947-305e6072eaa5&tenantId=0fddfdc5-f319-491f-a514-be1bc1bf9ddc",
"membershipType": "private"
}The following example shows how to create a channel that will be used for importing messages.
POST https://graph.microsoft.com/v1.0/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels
Content-Type: application/json
{
"@microsoft.graph.channelCreationMode": "migration",
"displayName": "Import_150958_99z",
"description": "Import_150958_99z",
"createdDateTime": "2020-03-14T11:22:17.067Z"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response. The Content-Location header in the response specifies the path to the channel that is being provisioned. Once provisioned, this channel can be used for importing messages.
HTTP/1.1 201 Created
Location: /teams('57fb72d0-d811-46f4-8947-305e6072eaa5')/channels('19:4b6bed8d24574f6a9e436813cb2617d8@thread.tacv2')
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('57fb72d0-d811-46f4-8947-305e6072eaa5')/channels/$entity",
"id": "19:987c7a9fbe6447ccb3ea31bcded5c75c@thread.tacv2",
"createdDateTime": null,
"displayName": "Import_150958_99z",
"description": "Import_150958_99z",
"isFavoriteByDefault": null,
"email": null,
"webUrl": null,
"membershipType": null,
"moderationSettings": null
}The following example shows a request to create a private channel and add a user as a team owner.
POST https://graph.microsoft.com/v1.0/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels
Content-type: application/json
{
"@odata.type": "#Microsoft.Graph.channel",
"membershipType": "private",
"displayName": "My First Private Channel",
"description": "This is my first private channels",
"members":
[
{
"@odata.type":"#microsoft.graph.aadUserConversationMember",
"user@odata.bind":"https://graph.microsoft.com/v1.0/users('jacob@contoso.com')",
"roles":["owner"]
}
]
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
Note: To add a guest account to the channel, for the roles property, use the value
guest.
The following example shows the response.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('57fb72d0-d811-46f4-8947-305e6072eaa5')/channels/$entity",
"id": "19:33b76eea88574bd1969dca37e2b7a819@thread.skype",
"displayName": "My First Private Channel",
"description": "This is my first private channels",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19:33b76eea88574bd1969dca37e2b7a819@thread.skype/My%20First%20Private%20Channel?groupId=57fb72d0-d811-46f4-8947-305e6072eaa5&tenantId=0fddfdc5-f319-491f-a514-be1bc1bf9ddc",
"membershipType": "private"
}The following example shows how to create a shared channel.
POST https://graph.microsoft.com/v1.0/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels
Content-type: application/json
{
"displayName": "My First Shared Channel",
"description": "This is my first shared channel",
"membershipType": "shared",
"members": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('7640023f-fe43-573f-9ff4-84a9efe4acd6')",
"roles": [
"owner"
]
}
]
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Location: /teams/7640023f-fe43-4cc7-9bd3-84a9efe4acd6/operations/359d75f6-2bb8-4785-ab2d-377bf3d573fa
Content-Length: 0The following example shows how to create a shared channel shared with host team.
POST https://graph.microsoft.com/v1.0/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels
Content-type: application/json
{
"displayName": "My First Shared Channel",
"description": "This is my first shared channel",
"membershipType": "shared",
"members": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('7640023f-fe43-573f-9ff4-84a9efe4acd6')",
"roles": [
"owner"
]
}
],
"sharedWithTeams":[
{
"id": "57fb72d0-d811-46f4-8947-305e6072eaa5"
}
]
}The following example shows the response.
HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Location: /teams/7640023f-fe43-4cc7-9bd3-84a9efe4acd6/operations/359d75f6-2bb8-4785-ab2d-377bf3d573fa
Content-Length: 0