Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to getEmbeddedObjects(); (Domino Server API) returns wrong results

The Domino server API getEmbeddedObjects(); returns the wrong result (zero) when a mail containing an attachment (as embedded object) is sent from the script. Though an attachment is sent as an EmbeddedOBject, getEmbeddedObjects(); returns ZERO. The mail type is NOT MIME.

This is a Java application. Is there is any workaround for this problem?

I take the body from the document. If the body is of richtextitem, I call the getEmbeddedObjects() which returns zero though an attachment is present as embedded object.

like image 949
Rajath Avatar asked Feb 24 '23 00:02

Rajath


2 Answers

Looking through all of the items in a document for the possibility of an attachment is doing a lot of work for nothing. All you need to do is get the collection of attachment names using the @AttachmentNames formula (available through the evaluate() method of the Session object, using the Document argument), and if the collection contains more than an empty string, use the getAttachment() method of the document to get a handle to the corresponding EmbeddedObject.

getAttachment() can grab any attachment to a document, whether it's associated with a RichTextItem or a V2-style attachment (as would be created by a web UI or when converting external mail). And never be afraid to use Formula Language when it's appropriate -- it can make your life a whole lot simpler.

like image 149
Stan Rogers Avatar answered May 11 '23 16:05

Stan Rogers


Attachments do not necessarily have to be embedded inside a RichText field. To quote from the designer-help:

If you need access to OLE/2 embedded objects that exist in a document but are not part of a rich text item (for example, because the object was originally created on the document's form), use the EmbeddedObjects property in Document.

Another source of your problem could be, that there are several "Body" RichText items you would have to check.

HTH

like image 34
leyrer Avatar answered May 11 '23 15:05

leyrer