Reclaim Dataverse File Capacity Without Deleting Email History
Diesen Beitrag auf Deutsch lesen
Use a date-filtered FetchXML query and scheduled Power Automate flow to delete old activitymimeattachment rows while keeping emails intact.
TL;DR
Delete old Dataverse activitymimeattachment rows through a scheduled Power Automate flow, filtering parent emails with FetchXML. The example targets emails older than 90 days, processes up to 5,000 rows per run, excludes drafts, and warns that shared files may not release capacity until their final reference is removed.
Original by Shaheer Ahmad, on Shaheer365. Read the original
This is our own summary, not a republication or full translation.
Governance takeaway
- Makers: Keep the cleanup query limited to the intended email attachments, exclude the body column, and validate filenames and row counts before enabling deletes.
- Admins/CoE: Check the Power Platform admin center File breakdown, test in a development or sandbox environment, and schedule recurring batches with appropriate delete permissions.
- Security/Compliance: Obtain approval for the actual retention period because 90 days is only an example, and remember that deleted Dataverse attachments cannot be restored.
- Leadership/Business: Communicate that Outlook mailbox copies remain untouched and that capacity reports can take up to 72 hours to reflect deletions.
Frequently asked questions
Which Dataverse table should a Power Automate cleanup flow delete for old email attachments?
Delete rows from activitymimeattachment, exposed as the Dataverse Attachments table. The email records remain intact, while the underlying attachment relationship is removed.
How can FetchXML exclude email drafts when selecting Dataverse attachments?
Filter the parent email with actualend olderthan-x-days. Drafts lack actualend, so the query excludes them automatically.
Why might Dataverse file capacity stay unchanged after deleting attachment rows?
Capacity may remain unchanged when another activitymimeattachment row still references the same underlying attachment file. Shared files release bytes only after the last reference disappears.
