2

用 Microsoft.Graph V1.12.0 替换 MSOnline cmdlet。

报告邮箱UsageDetailsReport = null; IReportRootGetMailboxUsageDetailRequestBuilder 邮箱UsageDetailsRequestBuilder = null; IReportRootGetMailboxUsageDetailRequest 邮箱UsageDetailsRequest = null;

mailboxUsageDetailsRequestBuilder = graphServiceClient.Reports.GetMailboxUsageDetail(期间); 邮箱UsageDetailsRequest = 邮箱UsageDetailsRequestBuilder.Request(); 邮箱UsageDetailsReport = 等待邮箱UsageDetailsRequest.GetAsync();

最后一行抛出:

Newtonsoft.Json.JsonReaderException
  HResult=0x80131500
  Message=Unexpected character encountered while parsing value: R. Path '', line 0, position 0.
  Source=Newtonsoft.Json

Fiddler 使用正确的文件“位置”显示 302 响应,但响应正文仅包含 0,

解决方法是

HttpRequestMessage hrm = new HttpRequestMessage(HttpMethod.Get, mailboxUsageDetailsRequest.RequestUrl); 等待 graphClient.AuthenticationProvider.AuthenticateRequestAsync(hrm); HttpResponseMessage 响应 = 等待 graphClient.HttpProvider.SendAsync(hrm);

4

1 回答 1

0

Microsoft Graph .Net 客户端 v1.12.0 目前不以一流的方式支持 Reports API。您正在分享建议的解决方法,我们感谢您分享。响应是一个 csv 文件,这就是您看到 JsonReaderException 的原因。

于 2018-12-04T21:21:51.823 回答