【问题标题】:Outlook Property Accessor error: The property "ttp://schemas.microsoft.com/mapi/proptag/0x7FFE000B" is unknown or cannot be foundOutlook 属性访问器错误:属性“ttp://schemas.microsoft.com/mapi/proptag/0x7FFE000B”未知或找不到
【发布时间】:2015-03-26 03:20:37
【问题描述】:

我正在使用 Outlook 属性访问器来发送电子邮件附件。 这是我正在使用的代码:

 //check whether attachments are there or not
                            if (mailItem.Attachments.Count > 0)
                            {
                                //loop through all attachments
                                for (int j = 1; j <= mailItem.Attachments.Count; j++)
                                {
                                    //check if attachment is email attachment, then only save to local directory
                                    if (mailItem.Attachments[j].PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7FFE000B") == false)
                                    {
                                        //save email attachment to local directory
                                        mailItem.Attachments[j].SaveAsFile
                                            (attachmentPath + "\\" +
                                            mailItem.Attachments[j].FileName);
                                    }
                                }
                            }

大多数电子邮件都可以正常阅读,但对于其中一些,我收到此错误:

属性“ttp://schemas.microsoft.com/mapi/proptag/0x7FFE000B”未知或找不到。

我想知道这个错误的修复方法是什么,如果抛出错误,是否有任何解决方法?

【问题讨论】:

    标签: outlook


    【解决方案1】:

    这不是附件的必需属性,即并非所有附件都设置了该属性。

    DASL 属性名称对应于PR_ATTACHMENT_HIDDEN 属性标记。它指示附件是否对最终用户隐藏。

    【讨论】:

    • 那我如何检查附件是否有属性?
    • 如果特定属性不存在,GetProperty 方法将触发异常。您需要在代码中使用 try/catch 块。
    【解决方案2】:

    错误意味着PR_ATTACHMENT_HIDDEN 属性未在该特定附件上设置。您在OutlookSpy 中看到该属性了吗(单击 IMessage 按钮,转到 GetAttachmentTable 选项卡,双击附件)?

    这是完全正常的 - 您的代码不应假定已设置任何特定属性并且必须处理该异常。

    【讨论】:

    • 那我如何检查附件是否有属性?
    • 如果 GetProperty 引发异常(应使用 try...catch 捕获),则该属性不存在。如果你得到一个值,它确实存在。请注意,不同版本的 Outlook 中的行为不同:2007-2010 可能会因缺少属性而返回 null,Outlook 2013 会引发异常。
    猜你喜欢
    • 1970-01-01
    • 2017-09-03
    • 1970-01-01
    • 2019-10-26
    • 1970-01-01
    • 1970-01-01
    • 2015-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多