MailboxUsageDetailsRequest返回异常

时间:2018-12-04 16:37:53

标签: microsoft-graph-sdks

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

Report MailboxUsageDetailsReport = null; IReportRootGetMailboxUsageDetailRequestBuilder MailboxUsageDetailsRequestBuilder = null; IReportRootGetMailboxUsageDetailRequest MailboxUsageDetailsRequest = null;

mailboxUsageDetailsRequestBuilder = graphServiceClient.Reports.GetMailboxUsageDetail(period); mailboxUsageDetailsRequest = mailboxUsageDetailsRequestBuilder.Request(); MailboxUsageDetailsReport =等待mailUsageDetailsRequest.GetAsync();

最后一行抛出:

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

Fiddler显示了带有正确文件“ Location”的302响应,但响应主体仅包含0,

解决方法是

HttpRequestMessage hrm =新的HttpRequestMessage(HttpMethod.Get,mailboxUsageDetailsRequest.RequestUrl); 等待graphClient.AuthenticationProvider.AuthenticateRequestAsync(hrm); HttpResponseMessage response =等待graphClient.HttpProvider.SendAsync(hrm);

1 个答案:

答案 0 :(得分:0)

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