【问题标题】:Outlook attachment names in DASLDASL 中的 Outlook 附件名称
【发布时间】:2022-05-06 08:39:22
【问题描述】:

我正在尝试获取 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

【问题讨论】:

  • 编辑您的问题以添加它引发的错误的文本。

标签: vba outlook


【解决方案1】:

作为一般规则,您不能从文件夹内容表中检索子对象(收件人和附件)属性。您可能无法检索收件人姓名(因为它们公开为PR_DISPLAY_TO / PR_DISPLAY_CC / PR_DISPLAY_BCC 属性),但附件没有类似的东西。

您可以做的最好的事情是将列表过滤到仅包含附件的项目 - 使用 PR_HASATTACH(DASL 名称 http://schemas.microsoft.com/mapi/proptag/0x0E1B000B)MAPI 属性 - 然后遍历返回的项目并处理它们的 Attachments 集合。

在扩展 MAPI 级别(仅限 C++ 或 Delphi),您可以使用 PR_MESSAGE_ATTACHMENTSPR_MESSAGE_RECIPIENTS 属性对邮件收件人和附件创建子限制,但 OOM 根本不公开这些。如果使用Redemption(我是它的作者)是一个选项,它的RDOFolder.Items.Find/RestrictMAPITable.ExecSQL 版本允许指定Recipients/To/@987654337 @/BCC/Attachments 查询中的属性,但仅在 WHERE 子句中。

【讨论】:

    猜你喜欢
    • 2019-08-06
    • 1970-01-01
    • 2017-12-18
    • 1970-01-01
    • 2012-02-12
    • 1970-01-01
    • 2018-06-30
    • 1970-01-01
    • 2016-01-05
    相关资源
    最近更新 更多