我有一个NSF
包含两个附件的电子邮件。其中一个附件已损坏,如果我尝试保存它,Notes 会显示此消息The attachment may be corrupted. Would you like to continue with the available data?
如果单击是,Notes 会将损坏的附件保存到我指定的目录中。这很好。
我想使用 C# 中的对象模型做同样的事情。如果我运行NotesEmbeddedObject.ExtractFile()
,我会收到此异常消息:Notes error: Encoded Data Checksum Mismatch - Attachment may be corrupted
。没有文件版本写入我指定的目录。
我希望代码将损坏的版本写入目录。我怎样才能做到这一点?
现有代码:
//BEGIN Extract Attachment
//nItem is a NotesItem
if (nItem.type == IT_TYPE.ATTACHMENT)
{
try
{
string pAttachment = ((object[])nItem.Values)[0].ToString();
NotesDocument NDoc = NotesConnectionDatabase.AllDocuments.GetNthDocument(i);
NotesEmbeddedObject Neo = NDoc.GetAttachment(pAttachment);
NDoc.GetAttachment(pAttachment).ExtractFile(@"D:\projects\xxx\Attach\" + pAttachment);
}
catch (Exception e)
{
string eMessage = e.Message;
Console.WriteLine(eMessage);
}
}
//END Extract Attachment