Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Objective-C Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Objective-C) 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

Chilkat Objective-C Library Downloads

MAC OS X (Cocoa) Libs

iOS Libs

#import <CkoHttp.h>
#import <CkoJsonObject.h>
#import <CkoHttpResponse.h>

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;

// 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

CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json UpdateString: @"\"template@odata.bind\"" value: @"https://graph.microsoft.com/v1.0/teamsTemplates('standard')"];
[json UpdateString: @"visibility" value: @"Private"];
[json UpdateString: @"displayName" value: @"Sample Engineering Team"];
[json UpdateString: @"description" value: @"This is a sample engineering team, used to showcase the range of properties supported by this API"];
[json UpdateString: @"channels[0].displayName" value: @"Announcements"];
[json UpdateBool: @"channels[0].isFavoriteByDefault" value: YES];
[json UpdateString: @"channels[0].description" value: @"This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements."];
[json UpdateString: @"channels[1].displayName" value: @"Training"];
[json UpdateBool: @"channels[1].isFavoriteByDefault" value: YES];
[json UpdateString: @"channels[1].description" value: @"This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs."];
[json UpdateString: @"channels[1].tabs[0].\"teamsApp@odata.bind\"" value: @"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.web')"];
[json UpdateString: @"channels[1].tabs[0].name" value: @"A Pinned Website"];
[json UpdateString: @"channels[1].tabs[0].configuration.contentUrl" value: @"https://docs.microsoft.com/microsoftteams/microsoft-teams"];
[json UpdateString: @"channels[1].tabs[1].\"teamsApp@odata.bind\"" value: @"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')"];
[json UpdateString: @"channels[1].tabs[1].name" value: @"A Pinned YouTube Video"];
[json UpdateString: @"channels[1].tabs[1].configuration.contentUrl" value: @"https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ"];
[json UpdateString: @"channels[1].tabs[1].configuration.websiteUrl" value: @"https://www.youtube.com/watch?v=X8krAMdGvCQ"];
[json UpdateString: @"channels[2].displayName" value: @"Planning"];
[json UpdateString: @"channels[2].description" value: @"This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu."];
[json UpdateBool: @"channels[2].isFavoriteByDefault" value: NO];
[json UpdateString: @"channels[3].displayName" value: @"Issues and Feedback"];
[json UpdateString: @"channels[3].description" value: @"This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu."];
[json UpdateBool: @"memberSettings.allowCreateUpdateChannels" value: YES];
[json UpdateBool: @"memberSettings.allowDeleteChannels" value: YES];
[json UpdateBool: @"memberSettings.allowAddRemoveApps" value: YES];
[json UpdateBool: @"memberSettings.allowCreateUpdateRemoveTabs" value: YES];
[json UpdateBool: @"memberSettings.allowCreateUpdateRemoveConnectors" value: YES];
[json UpdateBool: @"guestSettings.allowCreateUpdateChannels" value: NO];
[json UpdateBool: @"guestSettings.allowDeleteChannels" value: NO];
[json UpdateBool: @"funSettings.allowGiphy" value: YES];
[json UpdateString: @"funSettings.giphyContentRating" value: @"Moderate"];
[json UpdateBool: @"funSettings.allowStickersAndMemes" value: YES];
[json UpdateBool: @"funSettings.allowCustomMemes" value: YES];
[json UpdateBool: @"messagingSettings.allowUserEditMessages" value: YES];
[json UpdateBool: @"messagingSettings.allowUserDeleteMessages" value: YES];
[json UpdateBool: @"messagingSettings.allowOwnerDeleteMessages" value: YES];
[json UpdateBool: @"messagingSettings.allowTeamMentions" value: YES];
[json UpdateBool: @"messagingSettings.allowChannelMentions" value: YES];
[json UpdateBool: @"discoverySettings.showInTeamsSearchAndSuggestions" value: YES];
[json UpdateString: @"installedApps[0].\"teamsApp@odata.bind\"" value: @"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')"];
[json UpdateString: @"installedApps[1].\"teamsApp@odata.bind\"" value: @"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')"];

[http SetRequestHeader: @"Content-type" value: @"application/json"];

// Adds the "Authorization: Bearer ACCESS_TOKEN" header.
http.AuthToken = @"ACCESS_TOKEN";

CkoHttpResponse *resp = [http PostJson3: @"https://graph.microsoft.com/v1.0/teams" contentType: @"application/json" json: json];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

// A successful response is indicated by a 202 response status code and an empty response body.
NSLog(@"%@%d",@"Response Status Code: ",[resp.StatusCode intValue]);
NSLog(@"%@",@"Response Body:");
NSLog(@"%@",resp.BodyStr);

if ([resp.StatusCode intValue] >= 400) {
    NSLog(@"%@",@"Response Header:");
    NSLog(@"%@",resp.Header);
    NSLog(@"%@",@"Failed.");
}
 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.