Home

MS Teams Graph API - get Team ID

%3CLINGO-SUB%20id%3D%22lingo-sub-324864%22%20slang%3D%22en-US%22%3EMS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324864%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20create%20MS%20Teams%20using%20Graph%20API%20and%20I%20wants%20get%20Team%20Id%20after%20it%20is%20created.%20However%20I%20can't%20find%20this%20properties%20in%20MS%20Teams%20Graph%20API.%3C%2FP%3E%3CP%3EPlease%20advise%20if%20this%20feature%20available%20in%20Graph%20API.%20Sample%20code%20will%20be%20very%20helpful.%20Thanks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EFollowing%20is%20the%20response%20JSON%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHTTP%2F1.1%20201%20Created%3CBR%20%2F%3EContent-type%3A%20application%2Fjson%3CBR%20%2F%3EContent-length%3A%20401%3C%2FP%3E%3CP%3E%7B%3CBR%20%2F%3E%22memberSettings%22%3A%20%7B%3CBR%20%2F%3E%22allowCreateUpdateChannels%22%3A%20true%2C%3CBR%20%2F%3E%22allowDeleteChannels%22%3A%20true%2C%3CBR%20%2F%3E%22allowAddRemoveApps%22%3A%20true%2C%3CBR%20%2F%3E%22allowCreateUpdateRemoveTabs%22%3A%20true%2C%3CBR%20%2F%3E%22allowCreateUpdateRemoveConnectors%22%3A%20true%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22guestSettings%22%3A%20%7B%3CBR%20%2F%3E%22allowCreateUpdateChannels%22%3A%20true%2C%3CBR%20%2F%3E%22allowDeleteChannels%22%3A%20true%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22messagingSettings%22%3A%20%7B%3CBR%20%2F%3E%22allowUserEditMessages%22%3A%20true%2C%3CBR%20%2F%3E%22allowUserDeleteMessages%22%3A%20true%2C%3CBR%20%2F%3E%22allowOwnerDeleteMessages%22%3A%20true%2C%3CBR%20%2F%3E%22allowTeamMentions%22%3A%20true%2C%3CBR%20%2F%3E%22allowChannelMentions%22%3A%20true%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22funSettings%22%3A%20%7B%3CBR%20%2F%3E%22allowGiphy%22%3A%20true%2C%3CBR%20%2F%3E%22giphyContentRating%22%3A%20%22strict%22%2C%3CBR%20%2F%3E%22allowStickersAndMemes%22%3A%20true%2C%3CBR%20%2F%3E%22allowCustomMemes%22%3A%20true%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-324864%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376922%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376922%22%20slang%3D%22en-US%22%3EAfter%20the%20manage%20part%3A%3CBR%20%2F%3EA%20similar%20team%20id%20might%20look%20like%20this%3A%3CBR%20%2F%3E%3CBR%20%2F%3E02bd9fd6-8f93-4758-87c3-1fb73740a316%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376921%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376921%22%20slang%3D%22en-US%22%3EWhat%20part%20of%20the%20URL%20is%20the%20ID%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324870%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324870%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20also%20get%20the%20ID%20via%20the%20%22teams%20and%20skype%20admin%20center%22%20-%26gt%3B%20click%20teams%20-%26gt%3B%20click%20a%20team%20you%20want%20id%20for%20then%20check%20the%20URL%20for%20the%20id%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExample%3A%3C%2FP%3E%3CP%3E%3CFONT%3E%3CA%20href%3D%22https%3A%2F%2Fadmin.teams.microsoft.com%2Fteams%2Fmanage%2F401edf53-0a95-4c82-a242-10ecb3dae7fb%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fadmin.teams.microsoft.com%2Fteams%2Fmanage%2F401edf53-0a95-4c82-a242-10ecb3dae7fb%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3E%2F%20Adam%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324868%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324868%22%20slang%3D%22en-US%22%3E%3CP%3EAlso%20listing%20all%20teams%20with%20graph%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fteams-list-all-teams%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fteams-list-all-teams%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3E%2F%20Adam%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324865%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324865%22%20slang%3D%22en-US%22%3E%3CP%3EHi!%20You%20can%20use%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3EGET%20%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fme%2FjoinedTeams%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fme%2FjoinedTeams%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3EThis%20will%20get%20you%20following%20output%3A%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3E%22id%22%3A%20%22401edf43-0a95-4b82-a242-108cv3dte7fb%22%2C%3CBR%20%2F%3E%22displayName%22%3A%20%22Acme%20Demo%22%2C%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%3E%22description%22%3A%20%22Let%C2%B4s%20use%20this%20Group%20for%20discussions%20and%20resources%20for%20the%20Project.%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%3E%22isArchived%22%3A%20false%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-439124%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-439124%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3BWhen%20I%20click%20on%20a%20specific%20team%2C%20I%20do%20not%20see%20the%20url%20in%20the%20format%20you%20shared.%3CBR%20%2F%3EWhen%20a%20channel%20in%20a%20team%20is%20selected%2C%20url%20looks%20like%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fteams.microsoft.com%2F_%23%2Fconversations%2F1.%2520Primary%2520-%2520Emerging%2520Issues%3FthreadId%3D19%3A1bf0c746208b4cdcb367563d0e0cb1fd%40thread.skype%26amp%3Bctx%3Dchannel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fteams.microsoft.com%2F_%23%2Fconversations%2F1.%2520Primary%2520-%2520Emerging%2520Issues%3FthreadId%3D19%3A1bf0c746208b4cdcb367563d0e0cb1f676d%40thread.skype%26amp%3Bctx%3Dchannel%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3ECan%20you%20please%20help%20how%20can%20I%20find%20the%20team%20Id%20as%20well%20as%20Channel%20Id%3F%3CBR%20%2F%3EI%20am%20a%20member%20of%20this%20team%20but%20not%20an%20admin.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-439175%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-439175%22%20slang%3D%22en-US%22%3EBut%20If%20youvarw%20a%20teams%20admin%20you%20can%20get%20it%20by%20the%20various%20ways%20I%20mentioned%20above%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-439713%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-439713%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3BThanks%20for%20you%20reply.%20%3CBR%20%2F%3EJust%20wanted%20to%20confirm%20that%20only%20Admin%20has%20access%20to%20Team%20Id%20and%20Channel%20Id%3F%3CBR%20%2F%3EIf%20I%20want%20to%20use%20the%20get%20messages%20API%3A%20GET%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fteams%2F%7Bid%7D%2Fchannels%2F%7Bid%7D%2Fmessages%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fteams%2F%7Bid%7D%2Fchannels%2F%7Bid%7D%2Fmessages%3C%2FA%3E%2C%3CBR%20%2F%3EI%20need%20to%20be%20Team%20Admin%20or%20get%20the%20Team%20Id%20and%20Channel%20Id%20from%20Team%20admin.%20The%20team%20members%20do%20not%20have%20access%20to%20that%20information.%20Is%20that%20correct%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-439900%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-439900%22%20slang%3D%22en-US%22%3ENo%2C%20they%20can!%20I%20believe%20they%20can%20just%20login%20to%20graph%20explorer%20%2C%20log%20in%20and%20run%20get%20my%20joined%20teams%20for%20example!%3CBR%20%2F%3E%3CBR%20%2F%3EAlso%2C%20anyone%20can%20just%20click%20the%20three%20dots%20next%20to%20a%20team%20-%20get%20link%20to%20team%20and%20in%20that%20link%20there%20is%20the%20team%20id%3CBR%20%2F%3E%3CBR%20%2F%3EAdam%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-441116%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-441116%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3BThanks.%26nbsp%3B%3Cimg%20id%3D%22smileyhappy%22%20class%3D%22emoticon%20emoticon-smileyhappy%22%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Fi%2Fsmilies%2F16x16_smiley-happy.png%22%20alt%3D%22Smiley%20Happy%22%20title%3D%22Smiley%20Happy%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-458759%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Teams%20Graph%20API%20-%20get%20Team%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-458759%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20have%20to%20parse%20Location%20header%20that%20you%20get%20back.%20It%20has%20structure%26nbsp%3BLocation%3A%20%2Fteams('teamId')%2Foperations('operationId')%3C%2FP%3E%3C%2FLINGO-BODY%3E
Pulak2409
Contributor

Hi,

I am trying to create MS Teams using Graph API and I wants get Team Id after it is created. However I can't find this properties in MS Teams Graph API.

Please advise if this feature available in Graph API. Sample code will be very helpful. Thanks.

 

Following is the response JSON

 

HTTP/1.1 201 Created
Content-type: application/json
Content-length: 401

{
"memberSettings": {
"allowCreateUpdateChannels": true,
"allowDeleteChannels": true,
"allowAddRemoveApps": true,
"allowCreateUpdateRemoveTabs": true,
"allowCreateUpdateRemoveConnectors": true
},
"guestSettings": {
"allowCreateUpdateChannels": true,
"allowDeleteChannels": true
},
"messagingSettings": {
"allowUserEditMessages": true,
"allowUserDeleteMessages": true,
"allowOwnerDeleteMessages": true,
"allowTeamMentions": true,
"allowChannelMentions": true
},
"funSettings": {
"allowGiphy": true,
"giphyContentRating": "strict",
"allowStickersAndMemes": true,
"allowCustomMemes": true
}
}

 

 

11 Replies

Hi! You can use:

 

GET   https://graph.microsoft.com/v1.0/me/joinedTeams

 

This will get you following output:

 

"id": "401edf43-0a95-4b82-a242-108cv3dte7fb",
"displayName": "Acme Demo",

"description": "Let´s use this Group for discussions and resources for the Project."

"isArchived": false

Also listing all teams with graph:

 

https://docs.microsoft.com/en-us/graph/teams-list-all-teams

 

/ Adam

You can also get the ID via the "teams and skype admin center" -> click teams -> click a team you want id for then check the URL for the id:

 

Example:

https://admin.teams.microsoft.com/teams/manage/401edf53-0a95-4c82-a242-10ecb3dae7fb

 

/ Adam

 

 

 

 

What part of the URL is the ID?
After the manage part:
A similar team id might look like this:

02bd9fd6-8f93-4758-87c3-1fb73740a316

@adam deltinger When I click on a specific team, I do not see the url in the format you shared.
When a channel in a team is selected, url looks like https://teams.microsoft.com/_#/conversations/1.%20Primary%20-%20Emerging%20Issues?threadId=19:1bf0c7...

Can you please help how can I find the team Id as well as Channel Id?
I am a member of this team but not an admin.

But If youvarw a teams admin you can get it by the various ways I mentioned above

@adam deltinger Thanks for you reply.
Just wanted to confirm that only Admin has access to Team Id and Channel Id?
If I want to use the get messages API: GET https://graph.microsoft.com/beta/teams/{id}/channels/{id}/messages,
I need to be Team Admin or get the Team Id and Channel Id from Team admin. The team members do not have access to that information. Is that correct?

No, they can! I believe they can just login to graph explorer , log in and run get my joined teams for example!

Also, anyone can just click the three dots next to a team - get link to team and in that link there is the team id

Adam

You have to parse Location header that you get back. It has structure Location: /teams('teamId')/operations('operationId')

Related Conversations