Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(Excel) Microsoft Teams - Create Team (complex request)Create a team with multiple channels, installed apps, and pinned tabs using delegated permissions For more information, see https://docs.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0&tabs=http#example-3-create-a-team-with-multiple-channels-installed-apps-and-pinned-tabs-using-delegated-permissions
' This example assumes the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. Dim http As Chilkat.Http Set http = Chilkat.NewHttp ' Build the following HTTP 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')" ' } ' ] ' } ' Use this online tool to generate code from sample JSON: ' Generate Code to Create JSON Dim json As Chilkat.JsonObject Set json = Chilkat.NewJsonObject Dim success As Boolean success = json.UpdateString("""template@odata.bind""","https://graph.microsoft.com/v1.0/teamsTemplates('standard')") success = json.UpdateString("visibility","Private") success = json.UpdateString("displayName","Sample Engineering Team") success = json.UpdateString("description","This is a sample engineering team, used to showcase the range of properties supported by this API") success = json.UpdateString("channels[0].displayName","Announcements") success = json.UpdateBool("channels[0].isFavoriteByDefault",True) success = json.UpdateString("channels[0].description","This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements.") success = json.UpdateString("channels[1].displayName","Training") success = json.UpdateBool("channels[1].isFavoriteByDefault",True) success = json.UpdateString("channels[1].description","This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs.") success = json.UpdateString("channels[1].tabs[0].""teamsApp@odata.bind""","https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.web')") success = json.UpdateString("channels[1].tabs[0].name","A Pinned Website") success = json.UpdateString("channels[1].tabs[0].configuration.contentUrl","https://docs.microsoft.com/microsoftteams/microsoft-teams") success = json.UpdateString("channels[1].tabs[1].""teamsApp@odata.bind""","https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')") success = json.UpdateString("channels[1].tabs[1].name","A Pinned YouTube Video") success = json.UpdateString("channels[1].tabs[1].configuration.contentUrl","https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ") success = json.UpdateString("channels[1].tabs[1].configuration.websiteUrl","https://www.youtube.com/watch?v=X8krAMdGvCQ") success = json.UpdateString("channels[2].displayName","Planning") success = json.UpdateString("channels[2].description","This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.") success = json.UpdateBool("channels[2].isFavoriteByDefault",False) success = json.UpdateString("channels[3].displayName","Issues and Feedback") success = json.UpdateString("channels[3].description","This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu.") success = json.UpdateBool("memberSettings.allowCreateUpdateChannels",True) success = json.UpdateBool("memberSettings.allowDeleteChannels",True) success = json.UpdateBool("memberSettings.allowAddRemoveApps",True) success = json.UpdateBool("memberSettings.allowCreateUpdateRemoveTabs",True) success = json.UpdateBool("memberSettings.allowCreateUpdateRemoveConnectors",True) success = json.UpdateBool("guestSettings.allowCreateUpdateChannels",False) success = json.UpdateBool("guestSettings.allowDeleteChannels",False) success = json.UpdateBool("funSettings.allowGiphy",True) success = json.UpdateString("funSettings.giphyContentRating","Moderate") success = json.UpdateBool("funSettings.allowStickersAndMemes",True) success = json.UpdateBool("funSettings.allowCustomMemes",True) success = json.UpdateBool("messagingSettings.allowUserEditMessages",True) success = json.UpdateBool("messagingSettings.allowUserDeleteMessages",True) success = json.UpdateBool("messagingSettings.allowOwnerDeleteMessages",True) success = json.UpdateBool("messagingSettings.allowTeamMentions",True) success = json.UpdateBool("messagingSettings.allowChannelMentions",True) success = json.UpdateBool("discoverySettings.showInTeamsSearchAndSuggestions",True) success = json.UpdateString("installedApps[0].""teamsApp@odata.bind""","https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')") success = json.UpdateString("installedApps[1].""teamsApp@odata.bind""","https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')") http.SetRequestHeader "Content-type","application/json" ' Adds the "Authorization: Bearer ACCESS_TOKEN" header. http.AuthToken = "ACCESS_TOKEN" Set resp = http.PostJson3("https://graph.microsoft.com/v1.0/teams","application/json",json) If (http.LastMethodSuccess = False) Then Debug.Print http.LastErrorText Exit Sub End If ' A successful response is indicated by a 202 response status code and an empty response body. Debug.Print "Response Status Code: "; resp.StatusCode Debug.Print "Response Body:" Debug.Print resp.BodyStr If (resp.StatusCode >= 400) Then Debug.Print "Response Header:" Debug.Print resp.Header Debug.Print "Failed." End If |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.