Microsoft Graph CSharp SDK and OneDrive for Business with a Service/Daemon application - Quota facet returns null(带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null)
问题描述
我正在针对 OneDrive for Business 的 Microsoft Graph CSharp SDK 进行编码,并且我正在尝试提取特定 User 的数据并请求返回配额信息.
I am coding against Microsoft Graph CSharp SDK for OneDrive for Business and I am trying to pull back data on a specific User and request back Quota information.
我的要求:
var user = await graphServiceClient.Users["test@test.onmicrosoft.com"].Request().GetAsync();
var drive = await graphServiceClient.Drives["test@test.onmicrosoft.com"].Request().GetAsync();
var quotaTotal = drive.Quota.Used;
var displayName = user.DisplayName;
var driveType = drive.DriveType;
var driveId = drive.Id;
问题——返回的数据都是null.Microsoft Graph SDK 是否支持为 OneDrive for Business 帐户拉回 Quota 方面?
The problem - the data that is returned is all null. Does the Microsoft Graph SDK have support to pull back Quota facet for OneDrive for Bussiness accounts?
更新
我还提供 client_id、client_secret 和 tenant_name 以在应用程序级权限上进行身份验证.
I am also providing the client_id, client_secret, and tenant_nameto authenticate on an application-level permission.
更新
为 drive 添加了屏幕截图,因为它返回所有 null.
Added a screenshot for drive since it returns all null.
推荐答案
感谢您报告问题.如果令牌中有 Files.Read.All 或 Files.ReadWrite.All 范围,则确实不会为 App Only 调用返回配额和所有者信息.我已经解决了这个问题,这个修复应该很快就会推广到生产环境.不过,作为一种解决方法,您可以为您的应用使用 Sites.FullControl.All 范围,这应该会返回配额和所有者信息.
Thanks for reporting the issue. The quota and owner information was indeed not being returned for App Only calls if you had Files.Read.All or Files.ReadWrite.All scope in the token. I have fixed the issue and the fix should roll out to Production soon. As a workaround though, you can use Sites.FullControl.All scope for your app and that should return the quota and owner information.
这篇关于带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null
基础教程推荐
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
