Outlook属性访问者错误

时间:2015-01-27 13:29:09

标签: outlook

我使用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);
                                    }
                                }
                            }

大多数电子邮件都可以正常阅读,但对于其中几封电子邮件,我收到此错误: 该属性&#34; ttp://schemas.microsoft.com/mapi/proptag/0x7FFE000B"未知或无法找到。

我想知道这个错误的解决方法是什么,如果出现错误,是否有任何变通办法?

由于

2 个答案:

答案 0 :(得分:0)

它不是附件的必需属性,即并非所有附件都具有该属性集。

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

答案 1 :(得分:0)

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

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

相关问题