Announcements
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.
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);
}
Reference this doc:
community.dynamics.com/.../deleting-email-attachments-in-dynamics-crm-2016
André Arnaud de Cal...
294,099
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator