Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Dynamics 2011 Attachment table and related tables for email attachment metadata

Posted on by Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 2011 Attachment table and related tables for email attachment metadata

    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

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Dynamics 2011 Attachment table and related tables for email attachment metadata

    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;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans