Extracting attachments within EM_NSFNOTUPDATEMAILBOX

I’m working to integrate a virus scanner into our Domino server. I’ve registered a handler for EM_NSFNOTEUPDATEMAILBOX/EM_REG_BEFORE. Part of that handler has this (simplified):

count = 0;

while (MailGetMessageAttachmentInfo(msg, count, &block, filename, NULL, NULL, NULL, NULL, NULL)) {

MailExtractMessageAttachment(msg, block, tmpnam());

}

MailGetMessageAttachmentInfo() works fine, returning the filename as requested (and other values if I ask for them). MailExtractMessageAttachment(), on the other hand, always returns ERR_DB_NOT_OPEN. Using NSFNoteExtractFile() in its place does the same thing.

Does anyone know what’s going on here? I have a valid message handle, so as far as I can tell it should work, but perhaps attachments are special in some way, and not yet available in the mail.box database? I’m out of ideas, so pointers would be greatly appreciated.

Thanks,

Rob.