使用 Microsoft Graph 获取 MailBoxUsageDetails 时遇到 JsonReaderException
JsonReaderException Encountered when Getting MailBoxUsageDetails with Microsoft Graph
我正在关注 https://docs.microsoft.com/en-us/graph/api/reportroot-getmailboxusagedetail?view=graph-rest-1.0&tabs=cs 中的 GetMailBoxUsageDetail 文档,但我收到 JsonReaderException。
完整的错误信息如下:JsonReaderException: Unexpected character encountered while parsing value: R. Path '', line 0, position 0.
我已确认我拥有适当的应用程序权限。我还使用了 Fiddler 并看到内容流正在返回到客户端应用程序,但是 Microsoft Graph API 似乎试图将内容反序列化为 Json 而不是。
public IActionResult Index()
{
var report = GetMailBoxUsageDetailAsync().Result;
return View();
}
public async Task<Report> GetMailBoxUsageDetailAsync(string period = "D7")
{
var graphClient = new GraphServiceClient(new MsalAuthenticationProvider());
var report = await graphClient.Reports.GetMailboxUsageMailboxCounts(period)
.Request()
.GetAsync();
return report;
}
我期待流式内容返回以下 headers:报告刷新日期、用户主体名称、显示名称、已删除、删除日期、创建日期、最后 Activity 日期、项目计数、已用存储(字节)、发出警告配额(字节)、禁止发送配额(字节)、禁止 Send/Receive 配额(字节)、报告期间
确实,它似乎是 de-serializing 响应负载的错误,并影响 Mailbox usage reports
的所有端点
It could be reproduced at least in msgraph-sdk-dotnet
version
1.15.0
在修复之前,可以考虑将以下解决方案作为备选方案:
//Construct and send a request
var requestUrl = graphClient.Reports.GetMailboxUsageMailboxCounts("D7").Request().RequestUrl;
var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
await graphClient.AuthenticationProvider.AuthenticateRequestAsync(request);
var response = await graphClient.HttpProvider.SendAsync(request);
// Get the csv report data
var csvData = await response.Content.ReadAsStringAsync();
我正在关注 https://docs.microsoft.com/en-us/graph/api/reportroot-getmailboxusagedetail?view=graph-rest-1.0&tabs=cs 中的 GetMailBoxUsageDetail 文档,但我收到 JsonReaderException。
完整的错误信息如下:JsonReaderException: Unexpected character encountered while parsing value: R. Path '', line 0, position 0.
我已确认我拥有适当的应用程序权限。我还使用了 Fiddler 并看到内容流正在返回到客户端应用程序,但是 Microsoft Graph API 似乎试图将内容反序列化为 Json 而不是。
public IActionResult Index()
{
var report = GetMailBoxUsageDetailAsync().Result;
return View();
}
public async Task<Report> GetMailBoxUsageDetailAsync(string period = "D7")
{
var graphClient = new GraphServiceClient(new MsalAuthenticationProvider());
var report = await graphClient.Reports.GetMailboxUsageMailboxCounts(period)
.Request()
.GetAsync();
return report;
}
我期待流式内容返回以下 headers:报告刷新日期、用户主体名称、显示名称、已删除、删除日期、创建日期、最后 Activity 日期、项目计数、已用存储(字节)、发出警告配额(字节)、禁止发送配额(字节)、禁止 Send/Receive 配额(字节)、报告期间
确实,它似乎是 de-serializing 响应负载的错误,并影响 Mailbox usage reports
的所有端点It could be reproduced at least in
msgraph-sdk-dotnet
version1.15.0
在修复之前,可以考虑将以下解决方案作为备选方案:
//Construct and send a request
var requestUrl = graphClient.Reports.GetMailboxUsageMailboxCounts("D7").Request().RequestUrl;
var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
await graphClient.AuthenticationProvider.AuthenticateRequestAsync(request);
var response = await graphClient.HttpProvider.SendAsync(request);
// Get the csv report data
var csvData = await response.Content.ReadAsStringAsync();