0

I have an requirment where i would like to know the current limit used by User for File Attachment and send it as csv files to the buisness. I am not finding a way where i can see fetch that space used.

I know salesforce provide following way to look at that for each user. Can i get that for all users in any csv file through dataloader or soql.

Click Your Name | Setup | Manage Users | Users.
Click the name of any user.
Click View next to the Used Data Space or Used File Space fields

Thanks

1

The following query seems to work to see how many bytes worth of Attachments a particular user has:

select Owner.Name, SUM(BodyLength) SpaceUsed from Attachment group by Owner.Name

Note that the space used metric on the User also includes ContentDocument, so you might need to run a the same query against that object as well if you use ContentDocument.

  • Thanks Illusive, will it give values in MB, which each user in using. – David Mycka Nov 9 '17 at 21:46
  • @DavidMycka On further inspection, it looks like BodyLength is in bytes. It's also appears larger than what might show up on the User object based on comparing the two in my org, probably because the User object divides by 1048576 (1024 * 1024). Unfortunately I don't think that SOQL has a way to modify a field before returning it. – IllusiveBrian Nov 9 '17 at 21:55
  • However, it would probably be pretty straightforward to write a scheduled job that takes the result of this query, puts the results in a csv file with the desired precision and sends an email to the relevant parties. – IllusiveBrian Nov 9 '17 at 21:58
  • Thanks IllusiveBrian, Can we think that BodyLength will give apporximation of total bytes used by user. And BodyLength divides by 1024 will give us approximate MB user holds. Correct?. – David Mycka Nov 9 '17 at 21:58
  • @DavidMycka This query should be precisely accurate in terms of total number of bytes used by a user (although note that you would also need to query ContentDocument as well if you want the full count, and I don't know how versioning comes into play). If you want MB, you should divide by 1048576. – IllusiveBrian Nov 9 '17 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.