APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
When you create a team, the SharePoint site of the general channel might fail to provision. If the site fails to provision after 5 minutes, use the Get filesFolder API to trigger provisioning.
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.
The Teamwork.Migrate.All permission is only supported for migration. In the future, Microsoft may require you or your customers to pay additional fees based on the amount of data imported.
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.
In the request body, supply a JSON representation of a team object. Optionally, specify a value for the firstChannelName property to name the first channel that is created. The default value of the first channel is General.
Response
If successful, this API returns a 202 Accepted response that contains a link to the teamsAsyncOperation.
Examples
Example 1: Delegated permissions
The following example shows a minimal request. Because the client omitted other properties, it's implicitly taking defaults from the predefined template represented by template.
Request
POST https://graph.microsoft.com/beta/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"displayName": "My Sample Team",
"description": "My Sample Team's Description",
"firstChannelName": "My First Channel of the sample team"
}
The following example shows a minimal request using application permissions. Because the client omitted other properties, it's implicitly taking defaults from the predefined template represented by template. When issuing a request with application permissions, a user must be specified in the members collection.
Note: You can only specify a single member as the owner in this scenario.
Request
POST https://graph.microsoft.com/beta/teams
Content-Type: application/json
{
"template@odata.bind":"https://graph.microsoft.com/beta/teamsTemplates('standard')",
"displayName":"My Sample Team",
"description":"My Sample Team’s Description",
"firstChannelName": "My First Channel of the sample team",
"members":[
{
"@odata.type":"#microsoft.graph.aadUserConversationMember",
"roles":[
"owner"
],
"user@odata.bind":"https://graph.microsoft.com/beta/users('0040b377-61d8-43db-94f5-81374122dc7e')"
}
]
}
Example 3: Create a team with multiple channels, installed apps, and pinned tabs using delegated permissions
The following example shows a request with a full payload. The client can override values in the base template and add to array-valued items to the extent allowed by validation rules for the specialization.
Request
POST https://graph.microsoft.com/beta/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"visibility": "Private",
"displayName": "Sample Engineering Team",
"description": "This is a sample engineering team, used to showcase the range of properties supported by this API",
"firstChannelName": "My First Channel of the team",
"channels": [
{
"displayName": "Announcements 📢",
"isFavoriteByDefault": true,
"description": "This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements."
},
{
"displayName": "Training 🏋️",
"isFavoriteByDefault": true,
"description": "This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs.",
"tabs": [
{
"teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.web')",
"displayName": "A Pinned Website",
"configuration": {
"contentUrl": "https://learn.microsoft.com/microsoftteams/microsoft-teams"
}
},
{
"teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')",
"displayName": "A Pinned YouTube Video",
"configuration": {
"contentUrl": "https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ",
"websiteUrl": "https://www.youtube.com/watch?v=X8krAMdGvCQ"
}
}
]
},
{
"displayName": "Planning 📅 ",
"description": "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.",
"isFavoriteByDefault": false
},
{
"displayName": "Issues and Feedback 🐞",
"description": "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu."
}
],
"memberSettings": {
"allowCreateUpdateChannels": true,
"allowDeleteChannels": true,
"allowAddRemoveApps": true,
"allowCreateUpdateRemoveTabs": true,
"allowCreateUpdateRemoveConnectors": true
},
"guestSettings": {
"allowCreateUpdateChannels": false,
"allowDeleteChannels": false
},
"funSettings": {
"allowGiphy": true,
"giphyContentRating": "Moderate",
"allowStickersAndMemes": true,
"allowCustomMemes": true
},
"messagingSettings": {
"allowUserEditMessages": true,
"allowUserDeleteMessages": true,
"allowOwnerDeleteMessages": true,
"allowTeamMentions": true,
"allowChannelMentions": true
},
"discoverySettings": {
"showInTeamsSearchAndSuggestions": true
},
"installedApps": [
{
"teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')"
},
{
"teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')"
}
]
}
The following example shows how you can create a new team from a group, given a groupId.
A few things to note about this call:
In order to create a team, the group you're creating it from must have a least one owner.
The team that's created will always inherit from the group's display name, visibility, specialization, and members. Therefore, when making this call with the group@odata.bind property, the inclusion of team displayName, visibility, specialization, or members@odata.bind properties return an error.
If the group was created less than 15 minutes ago, it's possible for the Create team call to fail with a 404 error code due to replication delays. We recommend that you retry the Create team call three times, with a 10 second delay between calls.
Specifying a first channel name with the firstChannelName property isn't supported when you create a team from a group.
POST https://graph.microsoft.com/beta/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"group@odata.bind": "https://graph.microsoft.com/beta/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Team
{
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/beta/teamsTemplates('standard')"
},
{
"group@odata.bind" , "https://graph.microsoft.com/beta/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTeam()
additionalData := map[string]interface{}{
"template@odata.bind" : "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"group@odata.bind" : "https://graph.microsoft.com/beta/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
teams, err := graphClient.Teams().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Team team = new Team();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('standard')");
additionalData.put("group@odata.bind", "https://graph.microsoft.com/beta/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')");
team.setAdditionalData(additionalData);
Team result = graphClient.teams().post(team);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Team;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Team();
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/beta/teamsTemplates(\'standard\')',
'group@odata.bind' => 'https://graph.microsoft.com/beta/groups(\'71392b2f-1765-406e-86af-5907d9bdb2ab\')',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->teams()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.team import Team
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Team(
additional_data = {
"template@odata_bind" : "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"group@odata_bind" : "https://graph.microsoft.com/beta/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')",
}
)
result = await graph_client.teams.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 5: Create a team from a group with multiple channels, installed apps, and pinned tabs
The following example shows a request that converts an existing group with extended properties that create the team with multiple channels, installed apps, and pinned tabs.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Team
{
Channels = new List<Channel>
{
new Channel
{
DisplayName = "Class Announcements 📢",
IsFavoriteByDefault = true,
},
new Channel
{
DisplayName = "Homework 🏋️",
IsFavoriteByDefault = true,
},
},
MemberSettings = new TeamMemberSettings
{
AllowCreateUpdateChannels = false,
AllowDeleteChannels = false,
AllowAddRemoveApps = false,
AllowCreateUpdateRemoveTabs = false,
AllowCreateUpdateRemoveConnectors = false,
},
InstalledApps = new List<TeamsAppInstallation>
{
new TeamsAppInstallation
{
AdditionalData = new Dictionary<string, object>
{
{
"teamsApp@odata.bind" , "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')"
},
},
},
new TeamsAppInstallation
{
AdditionalData = new Dictionary<string, object>
{
{
"teamsApp@odata.bind" , "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')"
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/beta/teamsTemplates('standard')"
},
{
"group@odata.bind" , "https://graph.microsoft.com/beta/groups('dbd8de4f-5d47-48da-87f1-594bed003375')"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Team team = new Team();
LinkedList<Channel> channels = new LinkedList<Channel>();
Channel channel = new Channel();
channel.setDisplayName("Class Announcements 📢");
channel.setIsFavoriteByDefault(true);
channels.add(channel);
Channel channel1 = new Channel();
channel1.setDisplayName("Homework 🏋️");
channel1.setIsFavoriteByDefault(true);
channels.add(channel1);
team.setChannels(channels);
TeamMemberSettings memberSettings = new TeamMemberSettings();
memberSettings.setAllowCreateUpdateChannels(false);
memberSettings.setAllowDeleteChannels(false);
memberSettings.setAllowAddRemoveApps(false);
memberSettings.setAllowCreateUpdateRemoveTabs(false);
memberSettings.setAllowCreateUpdateRemoveConnectors(false);
team.setMemberSettings(memberSettings);
LinkedList<TeamsAppInstallation> installedApps = new LinkedList<TeamsAppInstallation>();
TeamsAppInstallation teamsAppInstallation = new TeamsAppInstallation();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("teamsApp@odata.bind", "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')");
teamsAppInstallation.setAdditionalData(additionalData);
installedApps.add(teamsAppInstallation);
TeamsAppInstallation teamsAppInstallation1 = new TeamsAppInstallation();
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("teamsApp@odata.bind", "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')");
teamsAppInstallation1.setAdditionalData(additionalData1);
installedApps.add(teamsAppInstallation1);
team.setInstalledApps(installedApps);
HashMap<String, Object> additionalData2 = new HashMap<String, Object>();
additionalData2.put("template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('standard')");
additionalData2.put("group@odata.bind", "https://graph.microsoft.com/beta/groups('dbd8de4f-5d47-48da-87f1-594bed003375')");
team.setAdditionalData(additionalData2);
Team result = graphClient.teams().post(team);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Team;
use Microsoft\Graph\Beta\Generated\Models\Channel;
use Microsoft\Graph\Beta\Generated\Models\TeamMemberSettings;
use Microsoft\Graph\Beta\Generated\Models\TeamsAppInstallation;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Team();
$channelsChannel1 = new Channel();
$channelsChannel1->setDisplayName('Class Announcements 📢');
$channelsChannel1->setIsFavoriteByDefault(true);
$channelsArray []= $channelsChannel1;
$channelsChannel2 = new Channel();
$channelsChannel2->setDisplayName('Homework 🏋️');
$channelsChannel2->setIsFavoriteByDefault(true);
$channelsArray []= $channelsChannel2;
$requestBody->setChannels($channelsArray);
$memberSettings = new TeamMemberSettings();
$memberSettings->setAllowCreateUpdateChannels(false);
$memberSettings->setAllowDeleteChannels(false);
$memberSettings->setAllowAddRemoveApps(false);
$memberSettings->setAllowCreateUpdateRemoveTabs(false);
$memberSettings->setAllowCreateUpdateRemoveConnectors(false);
$requestBody->setMemberSettings($memberSettings);
$installedAppsTeamsAppInstallation1 = new TeamsAppInstallation();
$additionalData = [
'teamsApp@odata.bind' => 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'com.microsoft.teamspace.tab.vsts\')',
];
$installedAppsTeamsAppInstallation1->setAdditionalData($additionalData);
$installedAppsArray []= $installedAppsTeamsAppInstallation1;
$installedAppsTeamsAppInstallation2 = new TeamsAppInstallation();
$additionalData = [
'teamsApp@odata.bind' => 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'1542629c-01b3-4a6d-8f76-1938b779e48d\')',
];
$installedAppsTeamsAppInstallation2->setAdditionalData($additionalData);
$installedAppsArray []= $installedAppsTeamsAppInstallation2;
$requestBody->setInstalledApps($installedAppsArray);
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/beta/teamsTemplates(\'standard\')',
'group@odata.bind' => 'https://graph.microsoft.com/beta/groups(\'dbd8de4f-5d47-48da-87f1-594bed003375\')',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->teams()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.team import Team
from msgraph_beta.generated.models.channel import Channel
from msgraph_beta.generated.models.team_member_settings import TeamMemberSettings
from msgraph_beta.generated.models.teams_app_installation import TeamsAppInstallation
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Team(
channels = [
Channel(
display_name = "Class Announcements 📢",
is_favorite_by_default = True,
),
Channel(
display_name = "Homework 🏋️",
is_favorite_by_default = True,
),
],
member_settings = TeamMemberSettings(
allow_create_update_channels = False,
allow_delete_channels = False,
allow_add_remove_apps = False,
allow_create_update_remove_tabs = False,
allow_create_update_remove_connectors = False,
),
installed_apps = [
TeamsAppInstallation(
additional_data = {
"teams_app@odata_bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')",
}
),
TeamsAppInstallation(
additional_data = {
"teams_app@odata_bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')",
}
),
],
additional_data = {
"template@odata_bind" : "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"group@odata_bind" : "https://graph.microsoft.com/beta/groups('dbd8de4f-5d47-48da-87f1-594bed003375')",
}
)
result = await graph_client.teams.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 6: Create a team with a nonstandard base template type
Base template types are special templates that Microsoft created for specific industries. These base templates often contain proprietary apps that aren't available in the store and team properties that aren't yet supported individually in Microsoft Teams templates.
To create a team from a nonstandard base template, you want to change the template@odata.bind property in the request body from standard to point to the specific base template you’d like to create.
POST https://graph.microsoft.com/beta/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",
"displayName": "My Class Team",
"description": "My Class Team’s Description"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Team
{
DisplayName = "My Class Team",
Description = "My Class Team’s Description",
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/beta/teamsTemplates('educationClass')"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
mgc-beta teams create --body '{\
"template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",\
"displayName": "My Class Team",\
"description": "My Class Team’s Description"\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTeam()
displayName := "My Class Team"
requestBody.SetDisplayName(&displayName)
description := "My Class Team’s Description"
requestBody.SetDescription(&description)
additionalData := map[string]interface{}{
"template@odata.bind" : "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
teams, err := graphClient.Teams().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Team team = new Team();
team.setDisplayName("My Class Team");
team.setDescription("My Class Team’s Description");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('educationClass')");
team.setAdditionalData(additionalData);
Team result = graphClient.teams().post(team);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
'template@odata.bind': 'https://graph.microsoft.com/beta/teamsTemplates(\'educationClass\')',
displayName: 'My Class Team',
description: 'My Class Team’s Description'
};
await client.api('/teams')
.version('beta')
.post(team);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Team;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Team();
$requestBody->setDisplayName('My Class Team');
$requestBody->setDescription('My Class Team’s Description');
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/beta/teamsTemplates(\'educationClass\')',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->teams()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
"template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('educationClass')"
displayName = "My Class Team"
description = "My Class Team’s Description"
}
New-MgBetaTeam -BodyParameter $params
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.team import Team
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Team(
display_name = "My Class Team",
description = "My Class Team’s Description",
additional_data = {
"template@odata_bind" : "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",
}
)
result = await graph_client.teams.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
POST https://graph.microsoft.com/beta/teams
Content-Type: application/json
{
"templateDefinition@odata.bind": "https://graph.microsoft.com/beta/teamwork/teamTemplates/com.microsoft.teams.template.ManageAProject/definitions/Y29tLm1pY3Jvc29mdC50ZWFtcy50ZW1wbGF0ZS5NYW5hZ2VBUHJvamVjdCMjUHVibGljIyNhci1TQQ==",
"displayName": "My Sample Team",
"description": "My Sample Team’s Description"
}
Snippet not available
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
mgc-beta teams create --body '{\
\
"templateDefinition@odata.bind": "https://graph.microsoft.com/beta/teamwork/teamTemplates/com.microsoft.teams.template.ManageAProject/definitions/Y29tLm1pY3Jvc29mdC50ZWFtcy50ZW1wbGF0ZS5NYW5hZ2VBUHJvamVjdCMjUHVibGljIyNhci1TQQ==",\
\
"displayName": "My Sample Team",\
\
"description": "My Sample Team’s Description"\
\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 8: Create a team with a nonstandard base template type with extended properties
Base template types can be extended with other properties, enabling you to build on an existing base template with more team settings, channels, apps, or tabs.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Team
{
DisplayName = "My Class Team",
Description = "My Class Team’s Description",
Channels = new List<Channel>
{
new Channel
{
DisplayName = "Class Announcements 📢",
IsFavoriteByDefault = true,
},
new Channel
{
DisplayName = "Homework 🏋️",
IsFavoriteByDefault = true,
},
},
MemberSettings = new TeamMemberSettings
{
AllowCreateUpdateChannels = false,
AllowDeleteChannels = false,
AllowAddRemoveApps = false,
AllowCreateUpdateRemoveTabs = false,
AllowCreateUpdateRemoveConnectors = false,
},
InstalledApps = new List<TeamsAppInstallation>
{
new TeamsAppInstallation
{
AdditionalData = new Dictionary<string, object>
{
{
"teamsApp@odata.bind" , "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')"
},
},
},
new TeamsAppInstallation
{
AdditionalData = new Dictionary<string, object>
{
{
"teamsApp@odata.bind" , "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')"
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/beta/teamsTemplates('educationClass')"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTeam()
displayName := "My Class Team"
requestBody.SetDisplayName(&displayName)
description := "My Class Team’s Description"
requestBody.SetDescription(&description)
channel := graphmodels.NewChannel()
displayName := "Class Announcements 📢"
channel.SetDisplayName(&displayName)
isFavoriteByDefault := true
channel.SetIsFavoriteByDefault(&isFavoriteByDefault)
channel1 := graphmodels.NewChannel()
displayName := "Homework 🏋️"
channel1.SetDisplayName(&displayName)
isFavoriteByDefault := true
channel1.SetIsFavoriteByDefault(&isFavoriteByDefault)
channels := []graphmodels.Channelable {
channel,
channel1,
}
requestBody.SetChannels(channels)
memberSettings := graphmodels.NewTeamMemberSettings()
allowCreateUpdateChannels := false
memberSettings.SetAllowCreateUpdateChannels(&allowCreateUpdateChannels)
allowDeleteChannels := false
memberSettings.SetAllowDeleteChannels(&allowDeleteChannels)
allowAddRemoveApps := false
memberSettings.SetAllowAddRemoveApps(&allowAddRemoveApps)
allowCreateUpdateRemoveTabs := false
memberSettings.SetAllowCreateUpdateRemoveTabs(&allowCreateUpdateRemoveTabs)
allowCreateUpdateRemoveConnectors := false
memberSettings.SetAllowCreateUpdateRemoveConnectors(&allowCreateUpdateRemoveConnectors)
requestBody.SetMemberSettings(memberSettings)
teamsAppInstallation := graphmodels.NewTeamsAppInstallation()
additionalData := map[string]interface{}{
"teamsApp@odata.bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')",
}
teamsAppInstallation.SetAdditionalData(additionalData)
teamsAppInstallation1 := graphmodels.NewTeamsAppInstallation()
additionalData := map[string]interface{}{
"teamsApp@odata.bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')",
}
teamsAppInstallation1.SetAdditionalData(additionalData)
installedApps := []graphmodels.TeamsAppInstallationable {
teamsAppInstallation,
teamsAppInstallation1,
}
requestBody.SetInstalledApps(installedApps)
additionalData := map[string]interface{}{
"template@odata.bind" : "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
teams, err := graphClient.Teams().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Team team = new Team();
team.setDisplayName("My Class Team");
team.setDescription("My Class Team’s Description");
LinkedList<Channel> channels = new LinkedList<Channel>();
Channel channel = new Channel();
channel.setDisplayName("Class Announcements 📢");
channel.setIsFavoriteByDefault(true);
channels.add(channel);
Channel channel1 = new Channel();
channel1.setDisplayName("Homework 🏋️");
channel1.setIsFavoriteByDefault(true);
channels.add(channel1);
team.setChannels(channels);
TeamMemberSettings memberSettings = new TeamMemberSettings();
memberSettings.setAllowCreateUpdateChannels(false);
memberSettings.setAllowDeleteChannels(false);
memberSettings.setAllowAddRemoveApps(false);
memberSettings.setAllowCreateUpdateRemoveTabs(false);
memberSettings.setAllowCreateUpdateRemoveConnectors(false);
team.setMemberSettings(memberSettings);
LinkedList<TeamsAppInstallation> installedApps = new LinkedList<TeamsAppInstallation>();
TeamsAppInstallation teamsAppInstallation = new TeamsAppInstallation();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("teamsApp@odata.bind", "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')");
teamsAppInstallation.setAdditionalData(additionalData);
installedApps.add(teamsAppInstallation);
TeamsAppInstallation teamsAppInstallation1 = new TeamsAppInstallation();
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("teamsApp@odata.bind", "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')");
teamsAppInstallation1.setAdditionalData(additionalData1);
installedApps.add(teamsAppInstallation1);
team.setInstalledApps(installedApps);
HashMap<String, Object> additionalData2 = new HashMap<String, Object>();
additionalData2.put("template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('educationClass')");
team.setAdditionalData(additionalData2);
Team result = graphClient.teams().post(team);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Team;
use Microsoft\Graph\Beta\Generated\Models\Channel;
use Microsoft\Graph\Beta\Generated\Models\TeamMemberSettings;
use Microsoft\Graph\Beta\Generated\Models\TeamsAppInstallation;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Team();
$requestBody->setDisplayName('My Class Team');
$requestBody->setDescription('My Class Team’s Description');
$channelsChannel1 = new Channel();
$channelsChannel1->setDisplayName('Class Announcements 📢');
$channelsChannel1->setIsFavoriteByDefault(true);
$channelsArray []= $channelsChannel1;
$channelsChannel2 = new Channel();
$channelsChannel2->setDisplayName('Homework 🏋️');
$channelsChannel2->setIsFavoriteByDefault(true);
$channelsArray []= $channelsChannel2;
$requestBody->setChannels($channelsArray);
$memberSettings = new TeamMemberSettings();
$memberSettings->setAllowCreateUpdateChannels(false);
$memberSettings->setAllowDeleteChannels(false);
$memberSettings->setAllowAddRemoveApps(false);
$memberSettings->setAllowCreateUpdateRemoveTabs(false);
$memberSettings->setAllowCreateUpdateRemoveConnectors(false);
$requestBody->setMemberSettings($memberSettings);
$installedAppsTeamsAppInstallation1 = new TeamsAppInstallation();
$additionalData = [
'teamsApp@odata.bind' => 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'com.microsoft.teamspace.tab.vsts\')',
];
$installedAppsTeamsAppInstallation1->setAdditionalData($additionalData);
$installedAppsArray []= $installedAppsTeamsAppInstallation1;
$installedAppsTeamsAppInstallation2 = new TeamsAppInstallation();
$additionalData = [
'teamsApp@odata.bind' => 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'1542629c-01b3-4a6d-8f76-1938b779e48d\')',
];
$installedAppsTeamsAppInstallation2->setAdditionalData($additionalData);
$installedAppsArray []= $installedAppsTeamsAppInstallation2;
$requestBody->setInstalledApps($installedAppsArray);
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/beta/teamsTemplates(\'educationClass\')',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->teams()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.team import Team
from msgraph_beta.generated.models.channel import Channel
from msgraph_beta.generated.models.team_member_settings import TeamMemberSettings
from msgraph_beta.generated.models.teams_app_installation import TeamsAppInstallation
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Team(
display_name = "My Class Team",
description = "My Class Team’s Description",
channels = [
Channel(
display_name = "Class Announcements 📢",
is_favorite_by_default = True,
),
Channel(
display_name = "Homework 🏋️",
is_favorite_by_default = True,
),
],
member_settings = TeamMemberSettings(
allow_create_update_channels = False,
allow_delete_channels = False,
allow_add_remove_apps = False,
allow_create_update_remove_tabs = False,
allow_create_update_remove_connectors = False,
),
installed_apps = [
TeamsAppInstallation(
additional_data = {
"teams_app@odata_bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')",
}
),
TeamsAppInstallation(
additional_data = {
"teams_app@odata_bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')",
}
),
],
additional_data = {
"template@odata_bind" : "https://graph.microsoft.com/beta/teamsTemplates('educationClass')",
}
)
result = await graph_client.teams.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
POST https://graph.microsoft.com/beta/teams
Content-Type: application/json
{
"@microsoft.graph.teamCreationMode": "migration",
"template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"displayName": "My Sample Team",
"description": "My Sample Team’s Description",
"createdDateTime": "2020-03-14T11:22:17.067Z"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
CreatedDateTime = DateTimeOffset.Parse("2020-03-14T11:22:17.067Z"),
AdditionalData = new Dictionary<string, object>
{
{
"@microsoft.graph.teamCreationMode" , "migration"
},
{
"template@odata.bind" , "https://graph.microsoft.com/beta/teamsTemplates('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.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
mgc-beta teams create --body '{\
"@microsoft.graph.teamCreationMode": "migration",\
"template@odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",\
"displayName": "My Sample Team",\
"description": "My Sample Team’s Description",\
"createdDateTime": "2020-03-14T11:22:17.067Z"\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTeam()
displayName := "My Sample Team"
requestBody.SetDisplayName(&displayName)
description := "My Sample Team’s Description"
requestBody.SetDescription(&description)
createdDateTime , err := time.Parse(time.RFC3339, "2020-03-14T11:22:17.067Z")
requestBody.SetCreatedDateTime(&createdDateTime)
additionalData := map[string]interface{}{
"@microsoft.graph.teamCreationMode" : "migration",
"template@odata.bind" : "https://graph.microsoft.com/beta/teamsTemplates('standard')",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
teams, err := graphClient.Teams().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Team team = new Team();
team.setDisplayName("My Sample Team");
team.setDescription("My Sample Team’s Description");
OffsetDateTime createdDateTime = OffsetDateTime.parse("2020-03-14T11:22:17.067Z");
team.setCreatedDateTime(createdDateTime);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("@microsoft.graph.teamCreationMode", "migration");
additionalData.put("template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('standard')");
team.setAdditionalData(additionalData);
Team result = graphClient.teams().post(team);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Team;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Team();
$requestBody->setDisplayName('My Sample Team');
$requestBody->setDescription('My Sample Team’s Description');
$requestBody->setCreatedDateTime(new \DateTime('2020-03-14T11:22:17.067Z'));
$additionalData = [
'@microsoft.graph.teamCreationMode' => 'migration',
'template@odata.bind' => 'https://graph.microsoft.com/beta/teamsTemplates(\'standard\')',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->teams()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.team import Team
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Team(
display_name = "My Sample Team",
description = "My Sample Team’s Description",
created_date_time = "2020-03-14T11:22:17.067Z",
additional_data = {
"@microsoft_graph_team_creation_mode" : "migration",
"template@odata_bind" : "https://graph.microsoft.com/beta/teamsTemplates('standard')",
}
)
result = await graph_client.teams.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
If the request is unsuccessful, this method returns a 400 Bad Request response code.
400 Bad Request
The following are common reasons for this response:
createdDateTime is set in the future.
createdDateTime is correctly specified but the teamCreationMode instance attribute is missing or set to an invalid value.
Example 10: Application permissions using user principal name
Here's an example of a minimal request using application permissions. Because the client omitted other properties, it's implicitly taking defaults from the predefined template represented by template. You must specify a user in the members collection for requests with application permissions.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
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/beta/users('jacob@contoso.com')"
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/beta/teamsTemplates('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.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTeam()
displayName := "My Sample Team"
requestBody.SetDisplayName(&displayName)
description := "My Sample Team’s Description"
requestBody.SetDescription(&description)
conversationMember := graphmodels.NewAadUserConversationMember()
roles := []string {
"owner",
}
conversationMember.SetRoles(roles)
additionalData := map[string]interface{}{
"user@odata.bind" : "https://graph.microsoft.com/beta/users('jacob@contoso.com')",
}
conversationMember.SetAdditionalData(additionalData)
members := []graphmodels.ConversationMemberable {
conversationMember,
}
requestBody.SetMembers(members)
additionalData := map[string]interface{}{
"template@odata.bind" : "https://graph.microsoft.com/beta/teamsTemplates('standard')",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
teams, err := graphClient.Teams().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Team team = new Team();
team.setDisplayName("My Sample Team");
team.setDescription("My Sample Team’s Description");
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/beta/users('jacob@contoso.com')");
conversationMember.setAdditionalData(additionalData);
members.add(conversationMember);
team.setMembers(members);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('standard')");
team.setAdditionalData(additionalData1);
Team result = graphClient.teams().post(team);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Team;
use Microsoft\Graph\Beta\Generated\Models\ConversationMember;
use Microsoft\Graph\Beta\Generated\Models\AadUserConversationMember;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Team();
$requestBody->setDisplayName('My Sample Team');
$requestBody->setDescription('My Sample Team’s Description');
$membersConversationMember1 = new AadUserConversationMember();
$membersConversationMember1->setOdataType('#microsoft.graph.aadUserConversationMember');
$membersConversationMember1->setRoles(['owner', ]);
$additionalData = [
'user@odata.bind' => 'https://graph.microsoft.com/beta/users(\'jacob@contoso.com\')',
];
$membersConversationMember1->setAdditionalData($additionalData);
$membersArray []= $membersConversationMember1;
$requestBody->setMembers($membersArray);
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/beta/teamsTemplates(\'standard\')',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->teams()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.team import Team
from msgraph_beta.generated.models.conversation_member import ConversationMember
from msgraph_beta.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 = Team(
display_name = "My Sample Team",
description = "My Sample Team’s Description",
members = [
AadUserConversationMember(
odata_type = "#microsoft.graph.aadUserConversationMember",
roles = [
"owner",
],
additional_data = {
"user@odata_bind" : "https://graph.microsoft.com/beta/users('jacob@contoso.com')",
}
),
],
additional_data = {
"template@odata_bind" : "https://graph.microsoft.com/beta/teamsTemplates('standard')",
}
)
result = await graph_client.teams.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.