dhruvil29
dhruvil29

Reputation: 221

Not able to get Team Id

I am creating a Microsoft Team using application permission via graph API. The team is getting created successfully but I am not getting any response.

I am using the Graph SDK. Below is my code. This is the reference I am following.

                var team = new Team
                {
                    DisplayName = "standardhealthcareHospital",
                    Description = "standardhealthcareHospital",
                    Members = new TeamMembersCollectionPage()
                    {
                        new AadUserConversationMember
                        {
                            Roles = new List<String>()
                            {
                                "owner"
                            },
                            AdditionalData = new Dictionary<string, object>()
                            {
                                {"[email protected]", "https://graph.microsoft.com/v1.0/users('a5808510-0abf-46ba-a0c1-9cdb7c374e4a')"}
                            }
                        }
                    },
                    AdditionalData = new Dictionary<string, object>()
                    {

                        {"[email protected]", "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"}
                    }
                };

                var teamCreated = await graphClient.Teams
                     .Request()
                     .AddAsync(team);

Can anyone tell me what am I missing here? How can I get the Id of the team which just got created?

Thanks in advance.

Upvotes: 0

Views: 2027

Answers (1)

Shiva Keshav Varma
Shiva Keshav Varma

Reputation: 3595

You are not missing anything but as per the Github Post that I created, creating a team using Graph SDK doesn't give you the team details which got created. It is by design.

You can simply make a call filtering using the displayName on the /groups endpoint. Team Id is nothing but the group id.

https://graph.microsoft.com/v1.0/groups?$filter=displayName eq 'Bgroup'

Result:

enter image description here

Upvotes: 2

Related Questions