开发者

Lotus Notes - Saving Corrupt Attachment Programmatically - NotesEmbeddedObject

I have an NSF that contains an email message with two attachments. One of the attachments is corrupt, and if I attempt to save it, Notes displays this message The attachment may be corrupted. Would you like to continue with the available data?

If I click Yes, Notes saves the corrupt attachment to the directory I specify. This is good.

I would like to开发者_如何学JAVA do the same thing using the object model in C#. If I run NotesEmbeddedObject.ExtractFile(), I receive this exception message: Notes error: Encoded Data Checksum Mismatch - Attachment may be corrupted. No version of the file is written to the directory I specify.

I would like for the code to write the corrupted version to a directory. How can I do this?

Existing Code:

//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


I'm afraid not.

The NotesEmbeddedObject.ExtractFile method attempts to extract the attachment, but there's a checksum mismatch, and as soon as it gets that error, it throws an exception.

I don't know of any other Notes back-end classes that deal with attachments (maybe someone else does...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜