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
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
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;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156