Search code examples
javamime-typesattachmentlotus-dominocontent-type

determine the icon for mime attachments in lotus domino


I am using the Java-API for Lotus Domino. Current version of Domino is 8.5. I connect to Domino over DIIOP/CORBA. I want to create a document (email) with attachments. The email is a multipart MIME document. Attaching a file ist quite easy and works perfectly. However the attachment gets a generic document icon (empty gray page). I would like to set an appropriate icon for the actual content type - e.g. a word-icon for a .doc-file. Is this possible in any way? I have tried to modify the content type parameter of the setContentFromBytes-method but to no avail.

here's a sample code:

session.setConvertMIME(false);

File file = new File("c:\\temp\\file.docx");
MIMEEntity child = document.createChildEntity();
MIMEHeader header = child.createHeader("Content-Disposition");
header.setHeaderVal("attachment; filename=" + file.getName());

header = child.createHeader("Content-ID");
header.setHeaderVal(file.getName());

Stream stream = session.createStream();
stream.open(file.getAbsolutePath(), "binary");
child.setContentFromBytes(stream,"application/vnd.openxmlformats-officedocument.wordprocessingml.document", MIMEEntity.ENC_IDENTITY_BINARY);
child.encodeContent(MIMEEntity.ENC_BASE64);
stream.close();
stream.truncate();

// other code here...

session.setConvertMIME(true);

I have also tried the older "application/msword" content type but it also dont work.

Any ideas how to set the icon for the attachment?

Thanks!


Solution

  • I don't think it is possible.

    I believe the icon is looked up (from the registry) on the system that executes the code that attaches the file. Since you are using DIIOP/CORBA, that lookup occurs on the server. It's unlikely that the server has the Office software installed so it can't find the icon and just uses the generic one.