Hi,
For emails, I prioritize clean-up based on the following:
- Attachment Size: this can be found in the Activity Mime Attachment and Attachment tables.
- Length for the Email Description field (where the body is stored).
As I mentioned earlier, fortunately for an on-premise environment, I can do queries like:
SELECT TOP 1000 ActivityID FROM Email
ORDER BY LEN(DESCRIPTION) DESC
For online, get the data out of this table and mark the Emails
- having bigger attachments
- sort by Length of Description
Again, we cannot get the actual disk size, but for sure, emails with longer bodies will take up more space.
Another, challenge is to mark such emails (add a flag and update emails candidate for delete), so you can schedule a bulk delete job in Dynamics 365.
For your second question, identify why you have so many emails? Are these actual customer collaborations or Marketing emails.
In my scenario, space-occupying emails from Marketing (and the number is huge).
So we are planning to move away from the built-in marketing module and use either Dynamics 365 for Marketing or a 3rd-party tool.
In my opinion, the built-in marketing module is not robust enough to be used in today's competitive world.
We should move to a solution meant for bulk emails.
In short, having too much data in the Activity table is always a pain.
When I design a solution, I always think of the Activity table and try to keep it in control (maybe you can call it tool limitation).