jquisenberry
Programmer
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 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
If I click Yes, Notes saves the corrupt attachment to the directory I specify. This is good.
I would like to 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