Cree un nuevo canal en un equipo, tal como se especifica en el cuerpo de la solicitud. Al crear un canal, la longitud máxima del displayName canal es de 50 caracteres. Este es el nombre que aparece al usuario en Microsoft Teams.
Si va a crear un canal privado, puede agregar un máximo de 200 miembros.
Nota:
Algunos caracteres especiales en el nombre del canal harán que la API Get filesFolder devuelva un error. Para obtener más información, consulte Problemas conocidos.
Al crear un canal privado o compartido, es posible que el sitio de SharePoint no se aprovisione. Si el sitio no se aprovisiona después de 5 minutos, use la API Get filesFolder para desencadenar el aprovisionamiento.
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
Esta API admite permisos de administrador. Los administradores de servicios de Microsoft Teams pueden acceder a los equipos de los que no son miembros.
Los permisos Group.ReadWrite.All y Directory.ReadWrite.All solo se admiten por compatibilidad con versiones anteriores. Se recomienda actualizar las soluciones para usar un permiso alternativo enumerado en la tabla anterior y así evitar el uso de estos permisos en el futuro.
El permiso Channel.Create.Group usa el consentimiento específico del recurso. En el futuro, Microsoft puede requerir que usted o sus clientes paguen tarifas adicionales en función de la cantidad de datos importados mediante Teamwork.Migrate.All o las API de migración.
En el cuerpo de la solicitud, proporcione una representación JSON del objeto channel.
Respuesta
Si se ejecuta correctamente, este método devuelve un 201 Created código de respuesta y un objeto de canal en el cuerpo de la respuesta para un canal con un valor membershipType de standard o private. Para un canal con un valor membershipType de shared, este método devuelve un 202 Accepted código de respuesta y un vínculo a teamsAsyncOperation.
Ejemplos
Ejemplo 1: Creación de un canal estándar
Solicitud
En el ejemplo siguiente se muestra una solicitud para crear un canal estándar.
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Channel
{
DisplayName = "Architecture Discussion",
Description = "This channel is where we debate all future architecture plans",
MembershipType = ChannelMembershipType.Standard,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Channels.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewChannel()
displayName := "Architecture Discussion"
requestBody.SetDisplayName(&displayName)
description := "This channel is where we debate all future architecture plans"
requestBody.SetDescription(&description)
membershipType := graphmodels.STANDARD_CHANNELMEMBERSHIPTYPE
requestBody.SetMembershipType(&membershipType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
channels, err := graphClient.Teams().ByTeamId("team-id").Channels().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel channel = new Channel();
channel.setDisplayName("Architecture Discussion");
channel.setDescription("This channel is where we debate all future architecture plans");
channel.setMembershipType(ChannelMembershipType.Standard);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().post(channel);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Channel;
use Microsoft\Graph\Generated\Models\ChannelMembershipType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Channel();
$requestBody->setDisplayName('Architecture Discussion');
$requestBody->setDescription('This channel is where we debate all future architecture plans');
$requestBody->setMembershipType(new ChannelMembershipType('standard'));
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.channel import Channel
from msgraph.generated.models.channel_membership_type import ChannelMembershipType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Channel(
display_name = "Architecture Discussion",
description = "This channel is where we debate all future architecture plans",
membership_type = ChannelMembershipType.Standard,
)
result = await graph_client.teams.by_team_id('team-id').channels.post(request_body)
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
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"
}
Ejemplo 2: Creación de un canal privado en nombre del usuario
Solicitud
En el ejemplo siguiente se muestra una solicitud para crear un canal privado y agregar un usuario como propietario del equipo.
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"]
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Channel
{
OdataType = "#Microsoft.Graph.channel",
MembershipType = ChannelMembershipType.Private,
DisplayName = "My First Private Channel",
Description = "This is my first private channels",
Members = new List<ConversationMember>
{
new AadUserConversationMember
{
OdataType = "#microsoft.graph.aadUserConversationMember",
Roles = new List<string>
{
"owner",
},
AdditionalData = new Dictionary<string, object>
{
{
"user@odata.bind" , "https://graph.microsoft.com/v1.0/users('62855810-484b-4823-9e01-60667f8b12ae')"
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Channels.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewChannel()
membershipType := graphmodels.PRIVATE_CHANNELMEMBERSHIPTYPE
requestBody.SetMembershipType(&membershipType)
displayName := "My First Private Channel"
requestBody.SetDisplayName(&displayName)
description := "This is my first private channels"
requestBody.SetDescription(&description)
conversationMember := graphmodels.NewAadUserConversationMember()
roles := []string {
"owner",
}
conversationMember.SetRoles(roles)
additionalData := map[string]interface{}{
"user@odata.bind" : "https://graph.microsoft.com/v1.0/users('62855810-484b-4823-9e01-60667f8b12ae')",
}
conversationMember.SetAdditionalData(additionalData)
members := []graphmodels.ConversationMemberable {
conversationMember,
}
requestBody.SetMembers(members)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
channels, err := graphClient.Teams().ByTeamId("team-id").Channels().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel channel = new Channel();
channel.setOdataType("#Microsoft.Graph.channel");
channel.setMembershipType(ChannelMembershipType.Private);
channel.setDisplayName("My First Private Channel");
channel.setDescription("This is my first private channels");
LinkedList<ConversationMember> members = new LinkedList<ConversationMember>();
AadUserConversationMember conversationMember = new AadUserConversationMember();
conversationMember.setOdataType("#microsoft.graph.aadUserConversationMember");
LinkedList<String> roles = new LinkedList<String>();
roles.add("owner");
conversationMember.setRoles(roles);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("user@odata.bind", "https://graph.microsoft.com/v1.0/users('62855810-484b-4823-9e01-60667f8b12ae')");
conversationMember.setAdditionalData(additionalData);
members.add(conversationMember);
channel.setMembers(members);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().post(channel);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Channel;
use Microsoft\Graph\Generated\Models\ChannelMembershipType;
use Microsoft\Graph\Generated\Models\ConversationMember;
use Microsoft\Graph\Generated\Models\AadUserConversationMember;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Channel();
$requestBody->setOdataType('#Microsoft.Graph.channel');
$requestBody->setMembershipType(new ChannelMembershipType('private'));
$requestBody->setDisplayName('My First Private Channel');
$requestBody->setDescription('This is my first private channels');
$membersConversationMember1 = new AadUserConversationMember();
$membersConversationMember1->setOdataType('#microsoft.graph.aadUserConversationMember');
$membersConversationMember1->setRoles(['owner', ]);
$additionalData = [
'user@odata.bind' => 'https://graph.microsoft.com/v1.0/users(\'62855810-484b-4823-9e01-60667f8b12ae\')',
];
$membersConversationMember1->setAdditionalData($additionalData);
$membersArray []= $membersConversationMember1;
$requestBody->setMembers($membersArray);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.channel import Channel
from msgraph.generated.models.channel_membership_type import ChannelMembershipType
from msgraph.generated.models.conversation_member import ConversationMember
from msgraph.generated.models.aad_user_conversation_member import AadUserConversationMember
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Channel(
odata_type = "#Microsoft.Graph.channel",
membership_type = ChannelMembershipType.Private,
display_name = "My First Private Channel",
description = "This is my first private channels",
members = [
AadUserConversationMember(
odata_type = "#microsoft.graph.aadUserConversationMember",
roles = [
"owner",
],
additional_data = {
"user@odata_bind" : "https://graph.microsoft.com/v1.0/users('62855810-484b-4823-9e01-60667f8b12ae')",
}
),
],
)
result = await graph_client.teams.by_team_id('team-id').channels.post(request_body)
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Channel
{
DisplayName = "Import_150958_99z",
Description = "Import_150958_99z",
CreatedDateTime = DateTimeOffset.Parse("2020-03-14T11:22:17.067Z"),
AdditionalData = new Dictionary<string, object>
{
{
"@microsoft.graph.channelCreationMode" , "migration"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Channels.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel channel = new Channel();
channel.setDisplayName("Import_150958_99z");
channel.setDescription("Import_150958_99z");
OffsetDateTime createdDateTime = OffsetDateTime.parse("2020-03-14T11:22:17.067Z");
channel.setCreatedDateTime(createdDateTime);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("@microsoft.graph.channelCreationMode", "migration");
channel.setAdditionalData(additionalData);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().post(channel);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.channel import Channel
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Channel(
display_name = "Import_150958_99z",
description = "Import_150958_99z",
created_date_time = "2020-03-14T11:22:17.067Z",
additional_data = {
"@microsoft_graph_channel_creation_mode" : "migration",
}
)
result = await graph_client.teams.by_team_id('team-id').channels.post(request_body)
En el ejemplo siguiente se muestra la respuesta. El encabezado Content-Location de la respuesta especifica la ruta de acceso al canal que se está aprovisionando.
Una vez aprovisionado, este canal se puede usar para importar mensajes.
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"]
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Channel
{
OdataType = "#Microsoft.Graph.channel",
MembershipType = ChannelMembershipType.Private,
DisplayName = "My First Private Channel",
Description = "This is my first private channels",
Members = new List<ConversationMember>
{
new AadUserConversationMember
{
OdataType = "#microsoft.graph.aadUserConversationMember",
Roles = new List<string>
{
"owner",
},
AdditionalData = new Dictionary<string, object>
{
{
"user@odata.bind" , "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')"
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Channels.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewChannel()
membershipType := graphmodels.PRIVATE_CHANNELMEMBERSHIPTYPE
requestBody.SetMembershipType(&membershipType)
displayName := "My First Private Channel"
requestBody.SetDisplayName(&displayName)
description := "This is my first private channels"
requestBody.SetDescription(&description)
conversationMember := graphmodels.NewAadUserConversationMember()
roles := []string {
"owner",
}
conversationMember.SetRoles(roles)
additionalData := map[string]interface{}{
"user@odata.bind" : "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')",
}
conversationMember.SetAdditionalData(additionalData)
members := []graphmodels.ConversationMemberable {
conversationMember,
}
requestBody.SetMembers(members)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
channels, err := graphClient.Teams().ByTeamId("team-id").Channels().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel channel = new Channel();
channel.setOdataType("#Microsoft.Graph.channel");
channel.setMembershipType(ChannelMembershipType.Private);
channel.setDisplayName("My First Private Channel");
channel.setDescription("This is my first private channels");
LinkedList<ConversationMember> members = new LinkedList<ConversationMember>();
AadUserConversationMember conversationMember = new AadUserConversationMember();
conversationMember.setOdataType("#microsoft.graph.aadUserConversationMember");
LinkedList<String> roles = new LinkedList<String>();
roles.add("owner");
conversationMember.setRoles(roles);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("user@odata.bind", "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')");
conversationMember.setAdditionalData(additionalData);
members.add(conversationMember);
channel.setMembers(members);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().post(channel);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Channel;
use Microsoft\Graph\Generated\Models\ChannelMembershipType;
use Microsoft\Graph\Generated\Models\ConversationMember;
use Microsoft\Graph\Generated\Models\AadUserConversationMember;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Channel();
$requestBody->setOdataType('#Microsoft.Graph.channel');
$requestBody->setMembershipType(new ChannelMembershipType('private'));
$requestBody->setDisplayName('My First Private Channel');
$requestBody->setDescription('This is my first private channels');
$membersConversationMember1 = new AadUserConversationMember();
$membersConversationMember1->setOdataType('#microsoft.graph.aadUserConversationMember');
$membersConversationMember1->setRoles(['owner', ]);
$additionalData = [
'user@odata.bind' => 'https://graph.microsoft.com/v1.0/users(\'jacob@contoso.com\')',
];
$membersConversationMember1->setAdditionalData($additionalData);
$membersArray []= $membersConversationMember1;
$requestBody->setMembers($membersArray);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.channel import Channel
from msgraph.generated.models.channel_membership_type import ChannelMembershipType
from msgraph.generated.models.conversation_member import ConversationMember
from msgraph.generated.models.aad_user_conversation_member import AadUserConversationMember
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Channel(
odata_type = "#Microsoft.Graph.channel",
membership_type = ChannelMembershipType.Private,
display_name = "My First Private Channel",
description = "This is my first private channels",
members = [
AadUserConversationMember(
odata_type = "#microsoft.graph.aadUserConversationMember",
roles = [
"owner",
],
additional_data = {
"user@odata_bind" : "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')",
}
),
],
)
result = await graph_client.teams.by_team_id('team-id').channels.post(request_body)
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"
]
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Channel
{
DisplayName = "My First Shared Channel",
Description = "This is my first shared channel",
MembershipType = ChannelMembershipType.Shared,
Members = new List<ConversationMember>
{
new AadUserConversationMember
{
OdataType = "#microsoft.graph.aadUserConversationMember",
Roles = new List<string>
{
"owner",
},
AdditionalData = new Dictionary<string, object>
{
{
"user@odata.bind" , "https://graph.microsoft.com/v1.0/users('7640023f-fe43-573f-9ff4-84a9efe4acd6')"
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Channels.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewChannel()
displayName := "My First Shared Channel"
requestBody.SetDisplayName(&displayName)
description := "This is my first shared channel"
requestBody.SetDescription(&description)
membershipType := graphmodels.SHARED_CHANNELMEMBERSHIPTYPE
requestBody.SetMembershipType(&membershipType)
conversationMember := graphmodels.NewAadUserConversationMember()
roles := []string {
"owner",
}
conversationMember.SetRoles(roles)
additionalData := map[string]interface{}{
"user@odata.bind" : "https://graph.microsoft.com/v1.0/users('7640023f-fe43-573f-9ff4-84a9efe4acd6')",
}
conversationMember.SetAdditionalData(additionalData)
members := []graphmodels.ConversationMemberable {
conversationMember,
}
requestBody.SetMembers(members)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
channels, err := graphClient.Teams().ByTeamId("team-id").Channels().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel channel = new Channel();
channel.setDisplayName("My First Shared Channel");
channel.setDescription("This is my first shared channel");
channel.setMembershipType(ChannelMembershipType.Shared);
LinkedList<ConversationMember> members = new LinkedList<ConversationMember>();
AadUserConversationMember conversationMember = new AadUserConversationMember();
conversationMember.setOdataType("#microsoft.graph.aadUserConversationMember");
LinkedList<String> roles = new LinkedList<String>();
roles.add("owner");
conversationMember.setRoles(roles);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("user@odata.bind", "https://graph.microsoft.com/v1.0/users('7640023f-fe43-573f-9ff4-84a9efe4acd6')");
conversationMember.setAdditionalData(additionalData);
members.add(conversationMember);
channel.setMembers(members);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().post(channel);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Channel;
use Microsoft\Graph\Generated\Models\ChannelMembershipType;
use Microsoft\Graph\Generated\Models\ConversationMember;
use Microsoft\Graph\Generated\Models\AadUserConversationMember;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Channel();
$requestBody->setDisplayName('My First Shared Channel');
$requestBody->setDescription('This is my first shared channel');
$requestBody->setMembershipType(new ChannelMembershipType('shared'));
$membersConversationMember1 = new AadUserConversationMember();
$membersConversationMember1->setOdataType('#microsoft.graph.aadUserConversationMember');
$membersConversationMember1->setRoles(['owner', ]);
$additionalData = [
'user@odata.bind' => 'https://graph.microsoft.com/v1.0/users(\'7640023f-fe43-573f-9ff4-84a9efe4acd6\')',
];
$membersConversationMember1->setAdditionalData($additionalData);
$membersArray []= $membersConversationMember1;
$requestBody->setMembers($membersArray);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.channel import Channel
from msgraph.generated.models.channel_membership_type import ChannelMembershipType
from msgraph.generated.models.conversation_member import ConversationMember
from msgraph.generated.models.aad_user_conversation_member import AadUserConversationMember
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Channel(
display_name = "My First Shared Channel",
description = "This is my first shared channel",
membership_type = ChannelMembershipType.Shared,
members = [
AadUserConversationMember(
odata_type = "#microsoft.graph.aadUserConversationMember",
roles = [
"owner",
],
additional_data = {
"user@odata_bind" : "https://graph.microsoft.com/v1.0/users('7640023f-fe43-573f-9ff4-84a9efe4acd6')",
}
),
],
)
result = await graph_client.teams.by_team_id('team-id').channels.post(request_body)