How can I set a team picture using Microsoft graph API? Is there a way while provisioning Microsoft team using the automated way[Using Microsoft Graph Team API] we can set team picture icon or upload team picture icon using Microsoft graph API.
How can I set a team picture using Microsoft graph API? Is there a way while provisioning Microsoft team using the automated way[Using Microsoft Graph Team API] we can set team picture icon or upload team picture icon using Microsoft graph API.
Set Team Icon can be done by the below lines of code using Patch Request with custom Content-type using plaint HttpRequest in C#
HttpClient _httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "Valid_accessToken");
string graphUploadPhotoEndPoint = $"{GRAPH_ENDPOINT_1_0}/groups/{TeamsId or GroupId}/photo/$value";
var method = new HttpMethod("PATCH");
var request = new HttpRequestMessage(HttpMethod.Put, graphUploadPhotoEndPoint);
Stream stream = System.IO.File.OpenRead($"{IconPath}");
HttpContent content = new StreamContent(IconeContent);
request.Content = content;
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
var response = _httpClient.SendAsync(request).Result;
string sitesRootResponse = await response.Content.ReadAsStringAsync();
Yes you can do that through the group profile photo endpoint. Each Microsoft team relies on a unified group underneath so all operations done on a group will reflect on the team. Here is the documentation of the endpoint