Forum Discussion

gagsbh80's avatar
gagsbh80
Explorer | Level 4
8 years ago

Dropbox Space Usage Differences

Hello Greg,

We have few Dropbox for Biz accounts whose Usage Size is shown in Admin Console screen.
I used Dropbox API - GetSpaceUsageAsync of Dot Net SDK to obtain Space Usage programatically (using following API).

DropboxClient clientadmin2 = teamclient.AsMember(ti.Profile.TeamMemberId);
Dropbox.Api.Users.SpaceUsage spaceusage = await clientadmin2.Users.GetSpaceUsageAsync();

Dave Minns - Admin
dminns@xyz.com
Admin Console : 11.19 MB
API Calculated : 21.91 MB (22977638 bytes)

Adam Stuflick
adam@xyz.com
Admin Console : 48.93 MB
API Calculated: 50.76 MB (53226491 bytes)

DEMO Dropbox-Account
dsclient@xyz.net
Admin Console : 9.11 MB
API Calculated: 9.13 MB (9573449 bytes)

Gagan Bhatnagar
gagan@xyz.com
Admin Console : 12.86 MB
API Calculated : 14.71 MB (15421481 bytes)

The Space Usage of most of the Dropbox for Biz accounts obatined via API and on Admin Console screen differs.
For some of the accounts like Dave Minns - Admin, the Space Usage on Admin Console is 11.19 MB whereas API Calculated is 21.91 MB.

Can you help me understand why are we seeing such a difference and what can I do to obtain the correct values using API as shown in Admin console screen.

Thanks,
Gagan

8 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    Thanks for the post! I'll look into this and follow up here once I have some information for you.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    gagsbh80 Can you clarify which value you're looking at from the API? Please share the rest of the code you're using to process the result from GetSpaceUsageAsync if possible.

    Note that there are multiple 'used' values returned in a SpaceUsage, e.g.:

     

  • gagsbh80's avatar
    gagsbh80
    Explorer | Level 4
    8 years ago

    Hello Greg,

    Thanks for the reply.

    I am using the following API - SpaceUsage.Used and the following piece of code: 

    MembersListResult members = await teamclient.Team.MembersListAsync(margs);

    foreach (Dropbox.Api.Team.TeamMemberInfo ti in members.Members)
    {
    DropboxClient clientadmin2 = teamclient.AsMember(ti.Profile.TeamMemberId);
    Dropbox.Api.Users.SpaceUsage spaceusage = await clientadmin2.Users.GetSpaceUsageAsync();
    mbr.Usage = Math.Round(((double)spaceusage.Used / 1024 / 1024), 2).ToString() + " MB";
    ....
    ....
    }

    I tried TeamSpaceAllocation.Used after your reply. Please see code below:

    Dropbox.Api.Users.SpaceAllocation.Team sp1 = spaceusage.Allocation.AsTeam;
    Dropbox.Api.Users.TeamSpaceAllocation sp2 = sp1.Value; //returns 734686370
    decimal spaceused = ((decimal)sp2.Used/ 1024 / 1024); //returns 700.65
    spaceused = Math.Round(spaceused, 2);

    However, TeamSpaceAllocation.Used returns 734686370 bytes or 700.65 MB for every member in the for loop. This figure seems to be the total usage size of the team.

    Thanks,

    Gagan

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    gagsbh80 Thanks for following up. I did reply to your ticket later that day, but it sounds like that response didn't make it to you unfortunately. (Perhaps it went to your spam folder?)

    In any case, I can confirm that the web site and API are calculating these values differently (mainly due to differences in how we're counting space from shared folders). I'll let you know when I have an update on that.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    7 years ago

    We've added a new field to TeamSpaceAllocation named 'user_within_team_space_used_cached' that should match the value reported on the Dropbox web site.

    This is currently available in the API, and should be available in the next release of each of the official SDKs.

  • Gags's avatar
    Gags
    Helpful | Level 6
    7 years ago

    Thanks Greg,

    This new fields helped us get the correct value.

    Gagan

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!