Note: 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.
Note: Permissions marked with ** 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.
HTTP request
POST /teams
Request headers
Header
Value
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of a team object.
Response
If successful, this API returns a 202 Accepted response that contains a link to the teamsAsyncOperation.
Examples
Example 1: Delegated permissions
The following is an example of a minimal request. By omitting other properties, the client is implicitly taking defaults from the pre-defined template represented by template.
POST https://graph.microsoft.com/v1.0/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"displayName": "My Sample Team",
"description": "My Sample Team’s Description"
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
},
},
};
var result = await graphClient.Teams.PostAsync(requestBody);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Team team = new Team();
team.additionalDataManager().put("template@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/teamsTemplates('standard')"));
team.displayName = "My Sample Team";
team.description = "My Sample Team’s Description";
graphClient.teams()
.buildRequest()
.post(team);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Team();
$requestBody->setDisplayName('My Sample Team');
$requestBody->setDescription('My Sample Team’s Description');
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/v1.0/teamsTemplates(\'standard\')',
];
$requestBody->setAdditionalData($additionalData);
$requestResult = $graphServiceClient->teams()->post($requestBody);
The following is an example of a minimal request using application permissions. By omitting other properties, the client is 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.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
Members = new List<ConversationMember>
{
new ConversationMember
{
OdataType = "#microsoft.graph.aadUserConversationMember",
Roles = new List<string>
{
"owner",
},
AdditionalData = new Dictionary<string, object>
{
{
"user@odata.bind" , "https://graph.microsoft.com/v1.0/users('0040b377-61d8-43db-94f5-81374122dc7e')"
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
},
},
};
var result = await graphClient.Teams.PostAsync(requestBody);
Example 3: Create a team with multiple channels, installed apps, and pinned tabs using delegated permissions
The following is 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.
POST https://graph.microsoft.com/v1.0/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/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",
"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')"
}
]
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Team
{
Visibility = TeamVisibilityType.Private,
DisplayName = "Sample Engineering Team",
Description = "This is a sample engineering team, used to showcase the range of properties supported by this API",
Channels = new List<Channel>
{
new Channel
{
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.",
},
new Channel
{
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 = new List<TeamsTab>
{
new TeamsTab
{
DisplayName = "A Pinned Website",
Configuration = new TeamsTabConfiguration
{
ContentUrl = "https://learn.microsoft.com/microsoftteams/microsoft-teams",
},
AdditionalData = new Dictionary<string, object>
{
{
"teamsApp@odata.bind" , "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.web')"
},
},
},
new TeamsTab
{
DisplayName = "A Pinned YouTube Video",
Configuration = new TeamsTabConfiguration
{
ContentUrl = "https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ",
WebsiteUrl = "https://www.youtube.com/watch?v=X8krAMdGvCQ",
},
AdditionalData = new Dictionary<string, object>
{
{
"teamsApp@odata.bind" , "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')"
},
},
},
},
},
new Channel
{
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,
},
new Channel
{
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 = new TeamMemberSettings
{
AllowCreateUpdateChannels = true,
AllowDeleteChannels = true,
AllowAddRemoveApps = true,
AllowCreateUpdateRemoveTabs = true,
AllowCreateUpdateRemoveConnectors = true,
},
GuestSettings = new TeamGuestSettings
{
AllowCreateUpdateChannels = false,
AllowDeleteChannels = false,
},
FunSettings = new TeamFunSettings
{
AllowGiphy = true,
GiphyContentRating = GiphyRatingType.Moderate,
AllowStickersAndMemes = true,
AllowCustomMemes = true,
},
MessagingSettings = new TeamMessagingSettings
{
AllowUserEditMessages = true,
AllowUserDeleteMessages = true,
AllowOwnerDeleteMessages = true,
AllowTeamMentions = true,
AllowChannelMentions = true,
},
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/v1.0/teamsTemplates('standard')"
},
{
"discoverySettings" , new
{
ShowInTeamsSearchAndSuggestions = true,
}
},
},
};
var result = await graphClient.Teams.PostAsync(requestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
'template@odata.bind': 'https://graph.microsoft.com/v1.0/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',
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\')'
}
]
};
await client.api('/teams')
.post(team);
Import-Module Microsoft.Graph.Teams
$params = @{
"Template@odata.bind" = "https://graph.microsoft.com/v1.0/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"
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
}
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')"
}
)
}
New-MgTeam -BodyParameter $params
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Team();
$requestBody->setVisibility(new TeamVisibilityType('private'));
$requestBody->setDisplayName('Sample Engineering Team');
$requestBody->setDescription('This is a sample engineering team, used to showcase the range of properties supported by this API');
$channelsChannel1 = new Channel();
$channelsChannel1->setDisplayName('Announcements 📢');
$channelsChannel1->setIsFavoriteByDefault(true);
$channelsChannel1->setDescription('This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements.');
$channelsArray []= $channelsChannel1;
$channelsChannel2 = new Channel();
$channelsChannel2->setDisplayName('Training 🏋️');
$channelsChannel2->setIsFavoriteByDefault(true);
$channelsChannel2->setDescription('This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs.');
$tabsTeamsTab1 = new TeamsTab();
$tabsTeamsTab1->setDisplayName('A Pinned Website');
$tabsTeamsTab1Configuration = new TeamsTabConfiguration();
$tabsTeamsTab1Configuration->setContentUrl('https://learn.microsoft.com/microsoftteams/microsoft-teams');
$tabsTeamsTab1->setConfiguration($tabsTeamsTab1Configuration);
$additionalData = [
'teamsApp@odata.bind' => 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'com.microsoft.teamspace.tab.web\')',
];
$tabsTeamsTab1->setAdditionalData($additionalData);
$tabsArray []= $tabsTeamsTab1;
$tabsTeamsTab2 = new TeamsTab();
$tabsTeamsTab2->setDisplayName('A Pinned YouTube Video');
$tabsTeamsTab2Configuration = new TeamsTabConfiguration();
$tabsTeamsTab2Configuration->setContentUrl('https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ');
$tabsTeamsTab2Configuration->setWebsiteUrl('https://www.youtube.com/watch?v=X8krAMdGvCQ');
$tabsTeamsTab2->setConfiguration($tabsTeamsTab2Configuration);
$additionalData = [
'teamsApp@odata.bind' => 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps(\'com.microsoft.teamspace.tab.youtube\')',
];
$tabsTeamsTab2->setAdditionalData($additionalData);
$tabsArray []= $tabsTeamsTab2;
$channelsChannel2->setTabs($tabsArray);
$channelsArray []= $channelsChannel2;
$channelsChannel3 = new Channel();
$channelsChannel3->setDisplayName('Planning 📅 ');
$channelsChannel3->setDescription('This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.');
$channelsChannel3->setIsFavoriteByDefault(false);
$channelsArray []= $channelsChannel3;
$channelsChannel4 = new Channel();
$channelsChannel4->setDisplayName('Issues and Feedback 🐞');
$channelsChannel4->setDescription('This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.');
$channelsArray []= $channelsChannel4;
$requestBody->setChannels($channelsArray);
$memberSettings = new TeamMemberSettings();
$memberSettings->setAllowCreateUpdateChannels(true);
$memberSettings->setAllowDeleteChannels(true);
$memberSettings->setAllowAddRemoveApps(true);
$memberSettings->setAllowCreateUpdateRemoveTabs(true);
$memberSettings->setAllowCreateUpdateRemoveConnectors(true);
$requestBody->setMemberSettings($memberSettings);
$guestSettings = new TeamGuestSettings();
$guestSettings->setAllowCreateUpdateChannels(false);
$guestSettings->setAllowDeleteChannels(false);
$requestBody->setGuestSettings($guestSettings);
$funSettings = new TeamFunSettings();
$funSettings->setAllowGiphy(true);
$funSettings->setGiphyContentRating(new GiphyRatingType('moderate'));
$funSettings->setAllowStickersAndMemes(true);
$funSettings->setAllowCustomMemes(true);
$requestBody->setFunSettings($funSettings);
$messagingSettings = new TeamMessagingSettings();
$messagingSettings->setAllowUserEditMessages(true);
$messagingSettings->setAllowUserDeleteMessages(true);
$messagingSettings->setAllowOwnerDeleteMessages(true);
$messagingSettings->setAllowTeamMentions(true);
$messagingSettings->setAllowChannelMentions(true);
$requestBody->setMessagingSettings($messagingSettings);
$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/v1.0/teamsTemplates(\'standard\')',
'discoverySettings' => $requestBody = new DiscoverySettings();
$requestBody->setShowInTeamsSearchAndSuggestions(true);
$requestBody->setDiscoverySettings($discoverySettings);
];
$requestBody->setAdditionalData($additionalData);
$requestResult = $graphServiceClient->teams()->post($requestBody);
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 will 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.
POST https://graph.microsoft.com/v1.0/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"group@odata.bind": "https://graph.microsoft.com/v1.0/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')"
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Team
{
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
},
{
"group@odata.bind" , "https://graph.microsoft.com/v1.0/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')"
},
},
};
var result = await graphClient.Teams.PostAsync(requestBody);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Team team = new Team();
team.additionalDataManager().put("template@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/teamsTemplates('standard')"));
team.additionalDataManager().put("group@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')"));
graphClient.teams()
.buildRequest()
.post(team);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Team();
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/v1.0/teamsTemplates(\'standard\')',
'group@odata.bind' => 'https://graph.microsoft.com/v1.0/groups(\'71392b2f-1765-406e-86af-5907d9bdb2ab\')',
];
$requestBody->setAdditionalData($additionalData);
$requestResult = $graphServiceClient->teams()->post($requestBody);
Example 5: Create a team from a group with multiple channels, installed apps, and pinned tabs
The following is a request that converts an existing group with extended properties which will create the team with multiple channels, installed apps, and pinned tabs.
Example 6: Create a team with a non-standard 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 are not yet supported individually in Microsoft Teams templates.
To create a team from a non-standard base template, you’ll 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/v1.0/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')",
"displayName": "My Class Team",
"description": "My Class Team’s Description"
}
var graphClient = new GraphServiceClient(requestAdapter);
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/v1.0/teamsTemplates('educationClass')"
},
},
};
var result = await graphClient.Teams.PostAsync(requestBody);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Team team = new Team();
team.additionalDataManager().put("template@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')"));
team.displayName = "My Class Team";
team.description = "My Class Team’s Description";
graphClient.teams()
.buildRequest()
.post(team);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Team();
$requestBody->setDisplayName('My Class Team');
$requestBody->setDescription('My Class Team’s Description');
$additionalData = [
'template@odata.bind' => 'https://graph.microsoft.com/v1.0/teamsTemplates(\'educationClass\')',
];
$requestBody->setAdditionalData($additionalData);
$requestResult = $graphServiceClient->teams()->post($requestBody);
Example 7: Create a team with a non-standard base template type with extended properties
Base template types can be extended with additional properties, enabling you to build on an existing base template with additional team settings, channels, apps, or tabs.
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 9: Application permissions using user principal name
The following is an example of a minimal request using application permissions. By omitting other properties, the client is 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.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
Members = new List<ConversationMember>
{
new ConversationMember
{
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')"
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"template@odata.bind" , "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
},
},
};
var result = await graphClient.Teams.PostAsync(requestBody);