Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Sales forum / Delete Attachments fro...
Sales forum

Delete Attachments from Old Emails

(0) ShareShare
ReportReport
Posted on by

Hi all,

I'm in a great need, I hope someone can help me out.

My organization is needing to delete the attachments from the old emails to gain some space because it is on 100% of the storage, I had a workflow that was provided by microsoft that would delete these attachments by a on demand custom workflow BUT by microsoft's grace of updating versions, this plugin is no longer useful.

we're using Dynamics 365 and I really need a new plug-in to do this job, I can find these old e-mails, but I can't delete it right now.

Anyone can help?

Thanks in advance.

Categories:
  • Suggested answer
    ShahXu Profile Picture
    1,515 on at
    RE: Delete Attachments from Old Emails

    just use this code and you have no need to delete emails

    IOrganizationService Service = GetCrmService();
    QueryExpression queryAtt = new QueryExpression("activitymimeattachment");
    queryAtt.ColumnSet = new ColumnSet(new string[] { "activityid", "attachmentid","filesize" });
    queryAtt.Criteria.AddCondition(new ConditionExpression("filesize", ConditionOperator.GreaterEqual, 100000));
    EntityCollection eatt = Service.RetrieveMultiple(queryAtt);
    foreach (Entity item in eatt.Entities)
    {
    Service.Delete(item.LogicalName,item.Id);
    }

  • Suggested answer
    Frank Lee Profile Picture
    4,617 on at
    RE: Delete Attachments from Old Emails

    Reference this doc:

    community.dynamics.com/.../deleting-email-attachments-in-dynamics-crm-2016

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,099 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans