簡體   English   中英

Lotus Notes-以編程方式保存損壞的附件-NotesEmbeddedObject

[英]Lotus Notes - Saving Corrupt Attachment Programmatically - NotesEmbeddedObject

我有一個NSF ,其中包含帶有兩個附件的電子郵件。 附件之一已損壞,如果我嘗試保存它,Notes將顯示此消息The attachment may be corrupted. Would you like to continue with the available data? The attachment may be corrupted. Would you like to continue with the available data?

如果單擊“是”,Notes會將損壞的附件保存到我指定的目錄中。 這很好。

我想在C#中使用對象模型做同樣的事情。 如果我運行NotesEmbeddedObject.ExtractFile()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

恐怕不是。

NotesEmbeddedObject.ExtractFile方法嘗試提取附件,但是校驗和不匹配,一旦收到該錯誤,它將引發異常。

我不知道其他任何處理附件的Notes后端類(也許有人這樣做...)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM