【问题标题】:Lotus Notes - Saving Corrupt Attachment Programmatically - NotesEmbeddedObjectLotus Notes - 以编程方式保存损坏的附件 - NotesEmbeddedObject
【发布时间】:2011-06-24 17:02:23
【问题描述】:

我有一个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

【问题讨论】:

    标签: c# .net lotus-notes lotus lotus-domino


    【解决方案1】:

    恐怕不行。

    NotesEmbeddedObject.ExtractFile 方法尝试提取附件,但校验和不匹配,一旦收到该错误,它就会抛出异常。

    我不知道任何其他处理附件的 Notes 后端类(也许其他人会...)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-02
      相关资源
      最近更新 更多