使用图形 API 设置团队图片

时间:2021-04-14 05:56:01

标签: image microsoft-graph-api microsoft-graph-teams

我正在尝试使用图形 API 设置团队的图片。我使用的是 SDK 版本。

                byte[] imageArray = System.IO.File.ReadAllBytes(@"D:\TeamPhoto.png");
                string base64ImageRepresentation = Convert.ToBase64String(imageArray);

                byte[] bytes = Convert.FromBase64String(base64ImageRepresentation);

                using (MemoryStream ms = new MemoryStream(bytes))
                {
                    var d = await graphClient.Groups[teamId].Photo.Content
                    .Request()
                    .PutAsync(ms);
                }

但是我收到一个错误

<块引用>

无法在 Outlook Exchange Photo API 中设置目标照片: PhotoApiCallServiceException

谁能告诉我我在这里遗漏了什么?

堆栈跟踪:

   at Microsoft.Graph.HttpProvider.<SendAsync>d__18.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__40.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.BaseRequest.<SendStreamRequestAsync>d__36.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

提前致谢。

0 个答案:

没有答案