Office 365 GetByteArrayAsync

Office 365 GetByteArrayAsync

我受困于 diZerega 的图像文件处理程序 example

Dorrene Brown 在 GitHub

上也上传了一个类似的例子

1.-针对多租户环境提供了解决方案,但没有文档重点说明如果您必须在 Azure 配置门户中将多租户环境设置为 true,这是必须的配置步骤还是可选的?

2.-我不明白我必须获得哪种特定类型的令牌才能执行 函数 httpClient.GetByteArrayAsync 并将图像作为来自 SharePoint 在线的字节数组,这是否绑定到访问令牌,您只有在使用 AcquireTokenByRefreshTokenAsync(refreshToken, clientCredential) 进行重载时才能获得, resource) 还是仅使用 refreshToken 和 clientCredentials 的重载就足够了?

3.- 目前我收到一个带有 refreshToken 和 clientCredentials 重载的访问令牌,当我尝试获取图像时,我一直收到 401 错误未授权。

 var imgBytes = await httpClient.GetByteArrayAsync("https://MyDev.sharepoint.com/_vti_bin/wopi.ashx/files/9f8ea500aea44c56837ba5bb5b3287a1/contents?access_token=123..");

2,3 已解决 - 当我阅读 时,我又获得了访问令牌,但这次是使用 AcquireTokenByRefreshTokenAsync(result.RefreshToken, clientCredential, resource);并且 401 错误消失了。第1点仍然不清楚。

The solution is provided for a multi tenant environment but no documentation highlights if you must set the multi tenant environment on true in the azure configuration portal, is it a must configuration step or an optional?

对于多租户应用,将多租户设置为true是必须的配置。