Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving Corrupt Attachment Programmatically - NotesEmbeddedObject

Status
Not open for further replies.

jquisenberry

Programmer
Jun 17, 2004
2
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top