storageUsage and storageQuota

780
3
03-12-2019 06:04 AM
AndrewAdamson
New Contributor II

I'm looping through all users in our org to gather info for a dashboard.  I've noticed that on all users the storageUsage is the same along with storageQuota for each users.  All other results - role, created, modified, level, etc are all returning correct values for each users.

I'm using users.get(id) to pull info.  GIS is logged in under an admin account.  Expecting storageUsage to be different depending on user content loaded into online. But again the storageUsage is all the same for each user.

Is this expected? or am I doing something/thinking wrong?

3 Replies
ThomasColson
MVP Frequent Contributor

Any update on this? I'm seeing the same output. Was this confirmed as a bug?

0 Kudos
JonathanDawe1
Esri Contributor

I'm seeing this behaviour in 10.6 portal but not on ArcGIS Online.

0 Kudos
JillianRizzo
Esri Contributor

I understand the documentation does not make this very clear, but this property is used to return the total used space in the organization. This is why the same number is returned for each user you call it on. 

As a workaround, one of my colleagues created the below code snippet to determine user storage usage by adding up the size of all the items they own: 

# Accounts is a list of all user objects that you can query

Accounts = gis.users.search(query= None, max_users =500)

# For each user in the org, give me a list of the items they own

for user in Accounts:

storage = 0

userItems = user.items(max_items=100) # The max_items default is 100

if userItems: # Checks to see if the user owns items

for item in userItems:

# Adds up the total storage of all items the user owns, in bytes

storage += item.size

print (user.username + " is using {0} bytes of storage".format(storage))

Feel free to reach out with any questions! 

storageUsage and storageQuota

0 Kudos