Context:
I am creating new MS Teams team using MS Graph API in C#
My code:
var newTeam = new Team()
{
DisplayName = model.DisplayName,
Description = model.Description,
AdditionalData = new Dictionary<string, object>
{
["template@odata.bind"] = $"{graph.BaseUrl}/teamsTemplates('standard')",
["members"] = owners.ToArray()
}
};
var team = await graph.Teams.Request().AddAsync(newTeam);
Problem:
The team is created fine but I can't get it's id. Return type of AddAsync method is Task<Team> but it always returns null.
I have checked server response using Fiddler and found out that the id of created team is returned in response headers.
Content-Location: /teams('cbf27e30-658b-4021-a8c6-4002b9adaf41')
Unfortunately I don't know how to access this information.