我正在尝试获取Outlook表中的附件列表。
我尝试了以下代码。引发错误。非常感谢您的帮助,因为我是DASL查询的新手
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
答案 0 :(得分:1)
通常,您不能从文件夹内容表中检索子对象(收件人和附件)属性。您可能会或可能无法检索收件人名称(因为它们显示为PR_DISPLAY_TO
/ PR_DISPLAY_CC
/ PR_DISPLAY_BCC
属性),但是附件却没有。
您能做的最好的事情就是将列表过滤为仅包含附件的项目-使用PR_HASATTACH
(DASL名称http://schemas.microsoft.com/mapi/proptag/0x0E1B000B
)的MAPI属性-然后遍历返回的项目并处理其{{ 1}}集合。
在扩展MAPI级别(仅C ++或Delphi)上,可以使用Attachments
和PR_MESSAGE_ATTACHMENTS
属性在邮件收件人和附件上创建子限制,但是OOM根本不公开这些限制。如果选择使用Redemption,则其RDOFolder。Items。PR_MESSAGE_RECIPIENTS
/ Find
和MAPITable.ExecSQL的版本允许指定{{1} } / Restrict
/ Recipients
/ To
/ CC
属性中的查询,但只能在BCC
子句中使用。