web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Deleted e-mail attachments not removed from Attachment table

(0) ShareShare
ReportReport
Posted on by 70

Hi there,

When an e-mail attachment is deleted from an e-mail, the attachment is no longer visible on the e-mail.  However, the e-mail attachment and its data still exists in the Attachment table.  I set up a test CRM instance and it does not have this issue.  We are on version 8.2.5.4.  I haven't been able to find anything in logs or Event Viewer but something is obviously failing.  Any ideas out there?

*This post is locked for comments

I have the same question (0)
  • Neil McDonald 82 Profile Picture
    45 on at

    Hi Jeff,

    I know this is an old post, but did you ever find a resolution to this? I'm having the same issue with a customer.

    It seems that in one of the updates after the initial 8.2 release, deleted email attachments are marked for deletion using componentstate = 2 in the activitymimeattachment table, but they are never actually deleted.

    Thanks, Neil.

  • Jeff-B Profile Picture
    70 on at

    Hi Neil,

    Not really.  I wound up deleting the rows in the ActivityMimeAttachment and Attachment tables using SQL.  It got the job done, but probably not the way Microsoft would like it done.

  • Neil McDonald 82 Profile Picture
    45 on at

    Thanks for replying Jeff. I'll likely do the same.

    I found that the daily deletion service is running this command in SQL:

    delete from Attachment where AttachmentId not in (select AttachmentId from ActivityMimeAttachment)

    Since the activitymimeattachment table still contains the link to deleted attachments, it doesn't find anything to delete:

    I'll see if I can log it as a bug somewhere.

  • oriel Profile Picture
    67 on at

    Hey, Have you been able to overcome this, we are experiencing the same issue

  • Neil McDonald Profile Picture
    80 on at

    I'm afraid not. I resorted to writing a SQL script to identify the attachments, then set the filename to 'deleted.txt', the mimetype to 'text/plain' and the body to ''. This doesn't delete the files, but essentially turns them into an empty text file.

    The query I used to identify them is:

    select distinct(a.AttachmentId) from ActivityMimeAttachment am

    inner join attachment a on a.attachmentid = am.attachmentid

    where ComponentState=2 and ObjectTypeCode=4202 and a.filename<>'deleted.txt'

  • oriel Profile Picture
    67 on at

    Thank you for the update, I think we'll turn to Microsoft with this

  • Tilemontain Profile Picture
    5 on at

    Did you go to Microsoft with this one? I've run into the same situation where records are marked for deletion but not getting deleted.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans