'Outlook attachment names in DASL
I am trying to get a list of attachments in the Outlook table.
I have tried below code. It throws an error. Any help is much appreciated as I am new to DASL queries
strFilter = "@SQL=" & "urn:schemas:httpmail:datereceived" &
" >= '" & Me.FrmDate.ToString & "' AND " &
"urn:schemas:httpmail:datereceived" &
" <= '" & Me.ToDate.ToString & "'"
'Do search and obtain Table on Inbox
Dim oT As Outlook.Table = eFolder.GetTable(strFilter) 'PLEASE IGNORE eFolder as it is declared earlier in the code
oT.Sort("[SentOn]", True)
With oT.Columns
.Add("SenderName")
.Add("Subject")
.Add("urn:schemas:httpmail:textdescription")
.Add("Attachments")
End With
Solution 1:[1]
As a general rule, you cannot retrieve the sub-object (recipient and attachment) properties from a folder contents table. You may or may not be able to retrieve the recipient names (since they are exposed as PR_DISPLAY_TO / PR_DISPLAY_CC / PR_DISPLAY_BCC properties), but there is nothing like that for the attachments.
The best you can do is filter the list down to only the items with attachments - use PR_HASATTACH (DASL name http://schemas.microsoft.com/mapi/proptag/0x0E1B000B) MAPI property - and then loop through the returned items and process their Attachments collection.
On the Extended MAPI level (C++ or Delphi only), you can create sub-restrictions on the message recipients and attachments using the PR_MESSAGE_ATTACHMENTS and PR_MESSAGE_RECIPIENTS properties, but OOM does not expose these at all. If using Redemption (I am its author) is an option, its versions of RDOFolder.Items.Find/Restrict and MAPITable.ExecSQL allow to specify Recipients/To/CC/BCC/Attachments properties in the queries, but only in a WHERE clause.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
