Namespace: microsoft.graph
Criar uma nova equipe em um grupo.
Para criar uma equipe, o grupo deve ter pelo menos um proprietário.
Se a criação da chamada de equipa estiver atrasada, pode repetir a chamada até três vezes antes de ter de aguardar 15 minutos devido a um atraso de propagação. Se o grupo tiver sido criado há menos de 15 minutos, a chamada poderá falhar com um 404
código de erro devido a atrasos na replicação.
Se o grupo tiver sido criado há menos de 15 minutos, é possível que uma chamada crie uma equipa para falhar com um código de erro 404, devido a atrasos de replicação em curso.
O padrão recomendado é repetir a chamada Criar equipe três vezes, com um atraso de 10 segundos entre as chamadas.
Nota: O aprovisionamento do SharePoint não ocorre em tempo real, é um processo em segundo plano. Não é possível determinar a conclusão do aprovisionamento.
Esta API está disponível nas seguintes implementações de cloud nacionais.
Serviço global |
US Government L4 |
US Government L5 (DOD) |
China operada pela 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissões
Escolha a permissão ou permissões marcadas como menos privilegiadas para esta API. Utilize uma permissão ou permissões com privilégios mais elevados apenas se a sua aplicação o exigir. Para obter detalhes sobre as permissões delegadas e de aplicação, veja Tipos de permissão. Para saber mais sobre estas permissões, veja a referência de permissões.
Tipo de permissão |
Permissões com menos privilégios |
Permissões com privilégios superiores |
Delegado (conta corporativa ou de estudante) |
Group.ReadWrite.All |
Directory.ReadWrite.All |
Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
Aplicativo |
Group.ReadWrite.All |
Directory.ReadWrite.All |
Observação: esta API oferece transporte a permissões de administrador. Os administradores de serviços do Microsoft Teams podem aceder a grupos dos quais não são membros.
Solicitação HTTP
PUT /groups/{id}/team
Cabeçalho |
Valor |
Autorização |
{token} de portador. Obrigatório. Saiba mais sobre autenticação e autorização. |
Content-Type |
application/json |
Corpo da solicitação
No corpo da solicitação, forneça uma representação JSON de um objeto team.
Resposta
Se bem-sucedido, este método retorna um código de resposta 201 Created
e um objeto team no corpo da resposta.
Exemplo
Solicitação
O exemplo a seguir mostra uma solicitação.
PUT https://graph.microsoft.com/v1.0/groups/{id}/team
Content-type: application/json
{
"memberSettings": {
"allowCreatePrivateChannels": true,
"allowCreateUpdateChannels": true
},
"messagingSettings": {
"allowUserEditMessages": true,
"allowUserDeleteMessages": true
},
"funSettings": {
"allowGiphy": true,
"giphyContentRating": "strict"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Team
{
MemberSettings = new TeamMemberSettings
{
AllowCreatePrivateChannels = true,
AllowCreateUpdateChannels = true,
},
MessagingSettings = new TeamMessagingSettings
{
AllowUserEditMessages = true,
AllowUserDeleteMessages = true,
},
FunSettings = new TeamFunSettings
{
AllowGiphy = true,
GiphyContentRating = GiphyRatingType.Strict,
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Groups["{group-id}"].Team.PutAsync(requestBody);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
mgc groups team put --group-id {group-id} --body '{\
"memberSettings": {\
"allowCreatePrivateChannels": true,\
"allowCreateUpdateChannels": true\
},\
"messagingSettings": {\
"allowUserEditMessages": true,\
"allowUserDeleteMessages": true\
},\
"funSettings": {\
"allowGiphy": true,\
"giphyContentRating": "strict"\
}\
}\
'
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
// 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.NewTeam()
memberSettings := graphmodels.NewTeamMemberSettings()
allowCreatePrivateChannels := true
memberSettings.SetAllowCreatePrivateChannels(&allowCreatePrivateChannels)
allowCreateUpdateChannels := true
memberSettings.SetAllowCreateUpdateChannels(&allowCreateUpdateChannels)
requestBody.SetMemberSettings(memberSettings)
messagingSettings := graphmodels.NewTeamMessagingSettings()
allowUserEditMessages := true
messagingSettings.SetAllowUserEditMessages(&allowUserEditMessages)
allowUserDeleteMessages := true
messagingSettings.SetAllowUserDeleteMessages(&allowUserDeleteMessages)
requestBody.SetMessagingSettings(messagingSettings)
funSettings := graphmodels.NewTeamFunSettings()
allowGiphy := true
funSettings.SetAllowGiphy(&allowGiphy)
giphyContentRating := graphmodels.STRICT_GIPHYRATINGTYPE
funSettings.SetGiphyContentRating(&giphyContentRating)
requestBody.SetFunSettings(funSettings)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
team, err := graphClient.Groups().ByGroupId("group-id").Team().Put(context.Background(), requestBody, nil)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Team team = new Team();
TeamMemberSettings memberSettings = new TeamMemberSettings();
memberSettings.setAllowCreatePrivateChannels(true);
memberSettings.setAllowCreateUpdateChannels(true);
team.setMemberSettings(memberSettings);
TeamMessagingSettings messagingSettings = new TeamMessagingSettings();
messagingSettings.setAllowUserEditMessages(true);
messagingSettings.setAllowUserDeleteMessages(true);
team.setMessagingSettings(messagingSettings);
TeamFunSettings funSettings = new TeamFunSettings();
funSettings.setAllowGiphy(true);
funSettings.setGiphyContentRating(GiphyRatingType.Strict);
team.setFunSettings(funSettings);
Team result = graphClient.groups().byGroupId("{group-id}").team().put(team);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
memberSettings: {
allowCreatePrivateChannels: true,
allowCreateUpdateChannels: true
},
messagingSettings: {
allowUserEditMessages: true,
allowUserDeleteMessages: true
},
funSettings: {
allowGiphy: true,
giphyContentRating: 'strict'
}
};
await client.api('/groups/{id}/team')
.put(team);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Team;
use Microsoft\Graph\Generated\Models\TeamMemberSettings;
use Microsoft\Graph\Generated\Models\TeamMessagingSettings;
use Microsoft\Graph\Generated\Models\TeamFunSettings;
use Microsoft\Graph\Generated\Models\GiphyRatingType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Team();
$memberSettings = new TeamMemberSettings();
$memberSettings->setAllowCreatePrivateChannels(true);
$memberSettings->setAllowCreateUpdateChannels(true);
$requestBody->setMemberSettings($memberSettings);
$messagingSettings = new TeamMessagingSettings();
$messagingSettings->setAllowUserEditMessages(true);
$messagingSettings->setAllowUserDeleteMessages(true);
$requestBody->setMessagingSettings($messagingSettings);
$funSettings = new TeamFunSettings();
$funSettings->setAllowGiphy(true);
$funSettings->setGiphyContentRating(new GiphyRatingType('strict'));
$requestBody->setFunSettings($funSettings);
$result = $graphServiceClient->groups()->byGroupId('group-id')->team()->put($requestBody)->wait();
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
Import-Module Microsoft.Graph.Teams
$params = @{
memberSettings = @{
allowCreatePrivateChannels = $true
allowCreateUpdateChannels = $true
}
messagingSettings = @{
allowUserEditMessages = $true
allowUserDeleteMessages = $true
}
funSettings = @{
allowGiphy = $true
giphyContentRating = "strict"
}
}
Set-MgGroupTeam -GroupId $groupId -BodyParameter $params
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.team import Team
from msgraph.generated.models.team_member_settings import TeamMemberSettings
from msgraph.generated.models.team_messaging_settings import TeamMessagingSettings
from msgraph.generated.models.team_fun_settings import TeamFunSettings
from msgraph.generated.models.giphy_rating_type import GiphyRatingType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Team(
member_settings = TeamMemberSettings(
allow_create_private_channels = True,
allow_create_update_channels = True,
),
messaging_settings = TeamMessagingSettings(
allow_user_edit_messages = True,
allow_user_delete_messages = True,
),
fun_settings = TeamFunSettings(
allow_giphy = True,
giphy_content_rating = GiphyRatingType.Strict,
),
)
result = await graph_client.groups.by_group_id('group-id').team.put(request_body)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 201 Created
Content-type: application/json
{
"memberSettings": {
"allowCreateUpdateChannels": true,
"allowDeleteChannels": true,
"allowAddRemoveApps": true,
"allowCreateUpdateRemoveTabs": true,
"allowCreateUpdateRemoveConnectors": true
},
"guestSettings": {
"allowCreateUpdateChannels": true,
"allowDeleteChannels": true
},
"messagingSettings": {
"allowUserEditMessages": true,
"allowUserDeleteMessages": true,
"allowOwnerDeleteMessages": true,
"allowTeamMentions": true,
"allowChannelMentions": true
},
"funSettings": {
"allowGiphy": true,
"giphyContentRating": "strict",
"allowStickersAndMemes": true,
"allowCustomMemes": true
}
}
Conteúdo relacionado