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.
My request:
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;
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?
Update
I am also providing the client_id
, client_secret
, and tenant_name
to authenticate on an application-level permission.
Update
Added a screenshot for drive
since it returns all null.
The quota.used facet is not being returned by the service (I'll report this issue). You can use the total and remaining properties to determine the amount of used quota.
Update To answer your original question... Yes, the Microsoft Graph .Net Client library does support Quota and User on OneDrive for Business accounts.
I don't know why you aren't getting the quota returned in the response. I'm not familiar with OneDrive for Business quotas... Is it possible you don't have a quota? Just for the sake of being complete, I took your code:
I successfully got back a quota object without the used property. Here's what I see in the response.
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.