Create team
12/1/2020
15 minutes to read
In this article
Namespace: microsoft.graph
Create a new team .
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Team.Create, Group.ReadWrite.All, Directory.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
Team.Create, Teamwork.Migrate.All, Group.ReadWrite.All, Directory.ReadWrite.All
HTTP request
POST /teams
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 containing 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
.
Request
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"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = 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')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
template@odata.bind: "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
displayName: "My Sample Team",
description: "My Sample Team’s Description"
};
let res = await client.api('/teams')
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTeam *team = [[MSGraphTeam alloc] init];
[team setDisplayName:@"My Sample Team"];
[team setDescription:@"My Sample Team’s Description"];
NSError *error;
NSData *teamData = [team getSerializedDataWithError:&error];
[urlRequest setHTTPBody:teamData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient 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);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams/{teamId}/operations/{operationId}
Content-Location: /teams/{teamId}
Content-Length: 0
Example 2: Application permissions
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.
Request
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",
"members":[
{
"@odata.type":"#microsoft.graph.aadUserConversationMember",
"roles":[
"owner"
],
"user@odata.bind":"https://graph.microsoft.com/v1.0/users('0040b377-61d8-43db-94f5-81374122dc7e')"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
Members = (ITeamMembersCollectionPage)new List<ConversationMember>()
{
new 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')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
template@odata.bind:"https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
displayName:"My Sample Team",
description:"My Sample Team’s Description",
members:[
{
@odata.type:"#microsoft.graph.aadUserConversationMember",
roles:[
"owner"
],
user@odata.bind:"https://graph.microsoft.com/v1.0/users('0040b377-61d8-43db-94f5-81374122dc7e')"
}
]
};
let res = await client.api('/teams')
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTeam *team = [[MSGraphTeam alloc] init];
[team setDisplayName:@"My Sample Team"];
[team setDescription:@"My Sample Team’s Description"];
NSMutableArray *membersList = [[NSMutableArray alloc] init];
MSGraphConversationMember *members = [[MSGraphConversationMember alloc] init];
NSMutableArray *rolesList = [[NSMutableArray alloc] init];
[rolesList addObject: @"owner"];
[members setRoles:rolesList];
[membersList addObject: members];
[team setMembers:membersList];
NSError *error;
NSData *teamData = [team getSerializedDataWithError:&error];
[urlRequest setHTTPBody:teamData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient 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";
LinkedList<ConversationMember> membersList = new LinkedList<ConversationMember>();
AadUserConversationMember members = new AadUserConversationMember();
LinkedList<String> rolesList = new LinkedList<String>();
rolesList.add("owner");
members.roles = rolesList;
members.additionalDataManager().put("user@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/users('0040b377-61d8-43db-94f5-81374122dc7e')"));
membersList.add(members);
ConversationMemberCollectionResponse conversationMemberCollectionResponse = new ConversationMemberCollectionResponse();
conversationMemberCollectionResponse.value = membersList;
ConversationMemberCollectionPage conversationMemberCollectionPage = new ConversationMemberCollectionPage(conversationMemberCollectionResponse, null);
team.members = conversationMemberCollectionPage;
graphClient.teams()
.buildRequest()
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams/{teamId}/operations/{operationId}
Content-Location: /teams/{teamId}
Content-Length: 0
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
.
Request
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')",
"name": "A Pinned Website",
"configuration": {
"contentUrl": "https://docs.microsoft.com/microsoftteams/microsoft-teams"
}
},
{
"teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')",
"name": "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')"
}
]
}
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams/{teamId}/operations/{operationId}
Content-Location: /teams/{teamId}
Content-Length: 0
Example 4: Create a team from group
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.
Request
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('groupId')"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = 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('groupId')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
template@odata.bind: "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
group@odata.bind: "https://graph.microsoft.com/v1.0/groups('groupId')"
};
let res = await client.api('/teams')
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTeam *team = [[MSGraphTeam alloc] init];
NSError *error;
NSData *teamData = [team getSerializedDataWithError:&error];
[urlRequest setHTTPBody:teamData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient 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('groupId')"));
graphClient.teams()
.buildRequest()
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams/{teamId}/operations/{operationId}
Content-Location: /teams/{teamId}
Content-Length: 0
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.
To learn more about supported base template types and supported properties, see Get started with Teams templates .
Request
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('groupId')",
"channels":[
{
"displayName":"Class Announcements 📢",
"isFavoriteByDefault":true
},
{
"displayName":"Homework 🏋️",
"isFavoriteByDefault":true
}
],
"memberSettings":{
"allowCreateUpdateChannels":false,
"allowDeleteChannels":false,
"allowAddRemoveApps":false,
"allowCreateUpdateRemoveTabs":false,
"allowCreateUpdateRemoveConnectors":false
},
"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')"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = new Team
{
Channels = (ITeamChannelsCollectionPage)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 = (ITeamInstalledAppsCollectionPage)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')"},
{"group@odata.bind", "https://graph.microsoft.com/v1.0/groups('groupId')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
template@odata.bind:"https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
group@odata.bind:"https://graph.microsoft.com/v1.0/groups('groupId')",
channels:[
{
displayName:"Class Announcements 📢",
isFavoriteByDefault:true
},
{
displayName:"Homework 🏋️",
isFavoriteByDefault:true
}
],
memberSettings:{
allowCreateUpdateChannels:false,
allowDeleteChannels:false,
allowAddRemoveApps:false,
allowCreateUpdateRemoveTabs:false,
allowCreateUpdateRemoveConnectors:false
},
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')"
}
]
};
let res = await client.api('/teams')
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTeam *team = [[MSGraphTeam alloc] init];
NSMutableArray *channelsList = [[NSMutableArray alloc] init];
MSGraphChannel *channels = [[MSGraphChannel alloc] init];
[channels setDisplayName:@"Class Announcements 📢"];
[channels setIsFavoriteByDefault: true];
[channelsList addObject: channels];
MSGraphChannel *channels = [[MSGraphChannel alloc] init];
[channels setDisplayName:@"Homework 🏋️"];
[channels setIsFavoriteByDefault: true];
[channelsList addObject: channels];
[team setChannels:channelsList];
MSGraphTeamMemberSettings *memberSettings = [[MSGraphTeamMemberSettings alloc] init];
[memberSettings setAllowCreateUpdateChannels: false];
[memberSettings setAllowDeleteChannels: false];
[memberSettings setAllowAddRemoveApps: false];
[memberSettings setAllowCreateUpdateRemoveTabs: false];
[memberSettings setAllowCreateUpdateRemoveConnectors: false];
[team setMemberSettings:memberSettings];
NSMutableArray *installedAppsList = [[NSMutableArray alloc] init];
MSGraphTeamsAppInstallation *installedApps = [[MSGraphTeamsAppInstallation alloc] init];
[installedAppsList addObject: installedApps];
MSGraphTeamsAppInstallation *installedApps = [[MSGraphTeamsAppInstallation alloc] init];
[installedAppsList addObject: installedApps];
[team setInstalledApps:installedAppsList];
NSError *error;
NSData *teamData = [team getSerializedDataWithError:&error];
[urlRequest setHTTPBody:teamData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient 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('groupId')"));
LinkedList<Channel> channelsList = new LinkedList<Channel>();
Channel channels = new Channel();
channels.displayName = "Class Announcements 📢";
channels.isFavoriteByDefault = true;
channelsList.add(channels);
Channel channels1 = new Channel();
channels1.displayName = "Homework 🏋️";
channels1.isFavoriteByDefault = true;
channelsList.add(channels1);
ChannelCollectionResponse channelCollectionResponse = new ChannelCollectionResponse();
channelCollectionResponse.value = channelsList;
ChannelCollectionPage channelCollectionPage = new ChannelCollectionPage(channelCollectionResponse, null);
team.channels = channelCollectionPage;
TeamMemberSettings memberSettings = new TeamMemberSettings();
memberSettings.allowCreateUpdateChannels = false;
memberSettings.allowDeleteChannels = false;
memberSettings.allowAddRemoveApps = false;
memberSettings.allowCreateUpdateRemoveTabs = false;
memberSettings.allowCreateUpdateRemoveConnectors = false;
team.memberSettings = memberSettings;
LinkedList<TeamsAppInstallation> installedAppsList = new LinkedList<TeamsAppInstallation>();
TeamsAppInstallation installedApps = new TeamsAppInstallation();
installedApps.additionalDataManager().put("teamsApp@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')"));
installedAppsList.add(installedApps);
TeamsAppInstallation installedApps1 = new TeamsAppInstallation();
installedApps1.additionalDataManager().put("teamsApp@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')"));
installedAppsList.add(installedApps1);
TeamsAppInstallationCollectionResponse teamsAppInstallationCollectionResponse = new TeamsAppInstallationCollectionResponse();
teamsAppInstallationCollectionResponse.value = installedAppsList;
TeamsAppInstallationCollectionPage teamsAppInstallationCollectionPage = new TeamsAppInstallationCollectionPage(teamsAppInstallationCollectionResponse, null);
team.installedApps = teamsAppInstallationCollectionPage;
graphClient.teams()
.buildRequest()
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams/{teamId}/operations/{operationId}
Content-Location: /teams/{teamId}
Content-Length: 0
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.
To learn more about supported base template types, see Get started with Teams templates .
Request
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"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = 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')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
template@odata.bind: "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')",
displayName: "My Class Team",
description: "My Class Team’s Description"
};
let res = await client.api('/teams')
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTeam *team = [[MSGraphTeam alloc] init];
[team setDisplayName:@"My Class Team"];
[team setDescription:@"My Class Team’s Description"];
NSError *error;
NSData *teamData = [team getSerializedDataWithError:&error];
[urlRequest setHTTPBody:teamData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient 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);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams/{teamId}/operations/{operationId}
Content-Location: /teams/{teamId}
Content-Length: 0
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.
To learn more about supported base template types and supported properties, see Get started with Teams templates .
Request
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",
"channels":[
{
"displayName":"Class Announcements 📢",
"isFavoriteByDefault":true
},
{
"displayName":"Homework 🏋️",
"isFavoriteByDefault":true
}
],
"memberSettings":{
"allowCreateUpdateChannels":false,
"allowDeleteChannels":false,
"allowAddRemoveApps":false,
"allowCreateUpdateRemoveTabs":false,
"allowCreateUpdateRemoveConnectors":false
},
"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')"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = new Team
{
DisplayName = "My Class Team",
Description = "My Class Team’s Description",
Channels = (ITeamChannelsCollectionPage)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 = (ITeamInstalledAppsCollectionPage)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('educationClass')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const team = {
template@odata.bind:"https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')",
displayName:"My Class Team",
description:"My Class Team’s Description",
channels:[
{
displayName:"Class Announcements 📢",
isFavoriteByDefault:true
},
{
displayName:"Homework 🏋️",
isFavoriteByDefault:true
}
],
memberSettings:{
allowCreateUpdateChannels:false,
allowDeleteChannels:false,
allowAddRemoveApps:false,
allowCreateUpdateRemoveTabs:false,
allowCreateUpdateRemoveConnectors:false
},
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')"
}
]
};
let res = await client.api('/teams')
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTeam *team = [[MSGraphTeam alloc] init];
[team setDisplayName:@"My Class Team"];
[team setDescription:@"My Class Team’s Description"];
NSMutableArray *channelsList = [[NSMutableArray alloc] init];
MSGraphChannel *channels = [[MSGraphChannel alloc] init];
[channels setDisplayName:@"Class Announcements 📢"];
[channels setIsFavoriteByDefault: true];
[channelsList addObject: channels];
MSGraphChannel *channels = [[MSGraphChannel alloc] init];
[channels setDisplayName:@"Homework 🏋️"];
[channels setIsFavoriteByDefault: true];
[channelsList addObject: channels];
[team setChannels:channelsList];
MSGraphTeamMemberSettings *memberSettings = [[MSGraphTeamMemberSettings alloc] init];
[memberSettings setAllowCreateUpdateChannels: false];
[memberSettings setAllowDeleteChannels: false];
[memberSettings setAllowAddRemoveApps: false];
[memberSettings setAllowCreateUpdateRemoveTabs: false];
[memberSettings setAllowCreateUpdateRemoveConnectors: false];
[team setMemberSettings:memberSettings];
NSMutableArray *installedAppsList = [[NSMutableArray alloc] init];
MSGraphTeamsAppInstallation *installedApps = [[MSGraphTeamsAppInstallation alloc] init];
[installedAppsList addObject: installedApps];
MSGraphTeamsAppInstallation *installedApps = [[MSGraphTeamsAppInstallation alloc] init];
[installedAppsList addObject: installedApps];
[team setInstalledApps:installedAppsList];
NSError *error;
NSData *teamData = [team getSerializedDataWithError:&error];
[urlRequest setHTTPBody:teamData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient 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";
LinkedList<Channel> channelsList = new LinkedList<Channel>();
Channel channels = new Channel();
channels.displayName = "Class Announcements 📢";
channels.isFavoriteByDefault = true;
channelsList.add(channels);
Channel channels1 = new Channel();
channels1.displayName = "Homework 🏋️";
channels1.isFavoriteByDefault = true;
channelsList.add(channels1);
ChannelCollectionResponse channelCollectionResponse = new ChannelCollectionResponse();
channelCollectionResponse.value = channelsList;
ChannelCollectionPage channelCollectionPage = new ChannelCollectionPage(channelCollectionResponse, null);
team.channels = channelCollectionPage;
TeamMemberSettings memberSettings = new TeamMemberSettings();
memberSettings.allowCreateUpdateChannels = false;
memberSettings.allowDeleteChannels = false;
memberSettings.allowAddRemoveApps = false;
memberSettings.allowCreateUpdateRemoveTabs = false;
memberSettings.allowCreateUpdateRemoveConnectors = false;
team.memberSettings = memberSettings;
LinkedList<TeamsAppInstallation> installedAppsList = new LinkedList<TeamsAppInstallation>();
TeamsAppInstallation installedApps = new TeamsAppInstallation();
installedApps.additionalDataManager().put("teamsApp@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')"));
installedAppsList.add(installedApps);
TeamsAppInstallation installedApps1 = new TeamsAppInstallation();
installedApps1.additionalDataManager().put("teamsApp@odata.bind", new JsonPrimitive("https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')"));
installedAppsList.add(installedApps1);
TeamsAppInstallationCollectionResponse teamsAppInstallationCollectionResponse = new TeamsAppInstallationCollectionResponse();
teamsAppInstallationCollectionResponse.value = installedAppsList;
TeamsAppInstallationCollectionPage teamsAppInstallationCollectionPage = new TeamsAppInstallationCollectionPage(teamsAppInstallationCollectionResponse, null);
team.installedApps = teamsAppInstallationCollectionPage;
graphClient.teams()
.buildRequest()
.post(team);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams/{teamId}/operations/{operationId}
Content-Location: /teams/{teamId}
Content-Length: 0
See also