C API - How do I delete attachments properly with NSFNoteDetachFile()

If I send a message with an attachment from one notes user to another and then use my program to remove the attachment which uses NSFNoteDetachFile() function everything works fine.

But if I send an email from Outlook Express to a notes user and then use my program to remove the attachment something strange happens. I go into the mail box and try to forward the message and I get this error" Unable to copy file attachment: Server error: This database cannot be read due to an invalid on disk structure"

Can anyone help shed some light on this?

Thank you.

Subject: Re: C API - How do I delete attachments properly with NSFNoteDetachFile()

I’ve done this many times and never had a problem. I’ve never tried the exact scenario that you’ve described, but I could try to duplicate the test scenario and let you know. Are you using MailGetMessageAttachmentInfo to return the BLOCKID?

(pulled out of context but you get the idea)

MailGetMessageAttachmentInfo(hNote,0,&bidAttachment,szFilename,NULL,NULL,NULL,NULL,NULL);

NSFNoteDetachFile(hNote,bidAttachment);

NSFNoteUpdate(hNote,0);

NSFNoteClose(hNote);

-Mike

Subject: Same Caveat – forgot

Actually, the customer solution that this code was for left the attachment rendering in the body so the user knew there had been an attachment that was deleted.

I think you’d have to go into the body and edit the rich text to remove the icon rendering, i.e. the data between the CDHOTSPOTBEGIN and CDHOTSPOTEND tags.

Subject: C API - How do I delete attachments properly with NSFNoteDetachFile()

Is the file attachment in a rich text field? If so, and if you just remove the attachment but don’t remove the file hotspot, the conversion to SMTP to go to Outlook will likely fail.

Subject: RE: C API - How do I delete attachments properly with NSFNoteDetachFile()

Sorry for the delay and thank you to those who have written. This sounds like my problem. I thought I just needed to detach the attachment. How do I remove the hotspot? Because of this problem, should I test for the hotspot each time or will I be required to remove it everytime? Do you have a small example of how to properly remove an attachment that does not have this problem?

Thanks