Lotus Domino: Attaching multiple files to a document using MIME

352460 pts.
Tags:
Lotus Domino
MIME
In one of our enterprise, we're trying to attach several files to a document. We already have the file Lname and the content in a byte array. We've also found a solution to attach the files to a document using MIME:
  final MIMEEntity body = document.createMIMEEntity(fileName);
    final MIMEHeader bodyHeader = body.createHeader("Content-Disposition");

    final boolean isHeaderValSet = bodyHeader.setHeaderVal("attachment; filename="" + fileName + """);
    if (!isHeaderValSet) {
        throw new ComponentException("Could not set MIME header value.");
    }

    body.setContentFromBytes(fileContentOutput, mimeType, MIMEEntity.ENC_IDENTITY_BINARY);
    final boolean saveSuccessful = document.save();
    if (!saveSuccessful) {
        throw new Exception("Cannot attach file " + fileName + "to document: " + documentUniversalId);
    }
It's working for one file but when we try to upload another file, we keep getting this exception:
NotesException: Item body already exists
Is there a way to attach multiple files to a document (remember that we only have the file name and the content in a byte array)?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following