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)

Dynamics 2011 Attachment table and related tables for email attachment metadata

(0) ShareShare
ReportReport
Posted on by

Hello,

I am trying to build a table of specific attachments in our 2011 MSCRM database that are email attachments. This table  will be used to export the desired attachments. I'm trying to capture filename, filesize, created on date (of the email), file type, and some information about the Contact the email was sent regarding. 

Per this thread I am looking at the Attachment table https://social.microsoft.com/Forums/en-US/5efb1ae7-fda0-468e-bc36-3d0242e92edd/crm-2011-what-is-the-attachment-table-in-the-mscrm-database-storing?forum=crm 

I am looking for confirmation on the other tables I need to join to get the desired attributes.

Currently I am joining:

Attachment to ActivityMimeAttachment via AttachmentID

ActivityMimeAttachment to Email via ObjectID = ActivityID

Email  to Contact via RegardingObjectID = ContactId 

Will this work for what I am trying to accomplish or should I be looking at the Activity Pointer tables?

Thank you!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi wrxvave,

    Email attachments are stored in the Attachment table. You can modify this SQL Query to get the data you need:

    SELECT * FROM Attachment;
  • Community Member Profile Picture
    on at

    Hi Adrian,

    I'm aware the email attachments are stored in the Attachment table. I'm looking for more detail regarding tables I need to join to for some information about the attachment and the Contact that it was sent regarding.

    Here's a query I am using:

    select FileName, FileSize,em.CreatedOn,at.MimeType,cn.FirstName,cn.LastName,cn.someId, em.RegardingObjectTypeCode, em.Subject

    from MSCRM..Attachment at

    join MSCRM..ActivityMimeAttachment atm

    on at.AttachmentId = atm.AttachmentId

    join MSCRM..ActivityPointerBase em

    on atm.ObjectId = em.ActivityId

    join MSCRM..Contact cn

    on em.RegardingObjectId = cn.ContactId

    where at.FileName like '%resume%'

    and em.RegardingObjectTypeCode = '2' --emails regarding contact

    and YEAR(em.CreatedOn) > 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

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