- Local time
- Today, 19:18
- Joined
- Feb 19, 2013
- Messages
- 17,301
I know how to query outlook using sql to return emails in an outlook folder. One of the fields returned is a boolean to indicate whether the email has attachments. I also know how to get the attachment names (and the files if required) via the outlook object, but wondered if there is a sql way of returning the attachment names.
Using office 2010, the sql to return the emails in a specified folder (a subfolder of the inbox in this case) is
research indicates attachments are in a table
so in theory it should just be a matter of getting the connection string correct. Perhaps need to include some sort of ID for a specific email? a different tabletype or name?
this link refers to properties which is effectively what I use at the moment via the outlook object
but nothing in SQL?
Using office 2010, the sql to return the emails in a specified folder (a subfolder of the inbox in this case) is
Code:
SELECT *
FROM [Outlook 9.0;MAPILEVEL=myemailaddress|\inbox\PROFILE=Outlook;TABLETYPE=0;TABLENAME=For Processing;COLSETVERSION=12.0;DATABASE=C:\Users\{username}\AppData\Local\Temp\].[subfolder] AS O
research indicates attachments are in a table

Types of Tables
Outlines different types of tables, each type differentiated by the information that it presents, in Outlook 2013 and Outlook 2016.
learn.microsoft.com
so in theory it should just be a matter of getting the connection string correct. Perhaps need to include some sort of ID for a specific email? a different tabletype or name?
this link refers to properties which is effectively what I use at the moment via the outlook object

Office.MailboxEnums.AttachmentType enum - Office Add-ins
Specifies the attachment's type.
learn.microsoft.com
but nothing in SQL?