调用 getEmbeddedObjects(); (Domino 服务器 API)返回错误结果
当从脚本发送包含附件(作为嵌入对象)的邮件时,Domino 服务器 API getEmbeddedObjects();
返回错误结果(零)。 尽管附件是作为 EmbeddedOBject
发送的,但 getEmbeddedObjects();
返回 ZERO
。 邮件类型为NOT MIME
。
这是一个 Java 应用程序。这个问题有什么解决方法吗?
我从文档中取出正文。如果正文是 richtextitem,我调用 getEmbeddedObjects(),尽管附件作为嵌入对象存在,但它返回零。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看文档中的所有项目以查找附件的可能性是徒劳的大量工作。您需要做的就是使用 @AttachmentNames 公式获取附件名称的集合(可通过 Session 对象的 evaluate() 方法使用 Document 参数获得),如果该集合包含多个空字符串,请使用 getAttachment文档的()方法获取相应EmbeddedObject的句柄。
getAttachment() 可以抓取文档的任何附件,无论它是与 RichTextItem 还是 V2 样式附件关联(如由 Web UI 创建或在转换外部邮件时创建)。永远不要害怕在适当的时候使用公式语言——它可以让你的生活变得更加简单。
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.
附件不一定必须嵌入 RichText 字段中。引用设计师帮助:
问题的另一个根源可能是,您必须检查多个“正文”RichText 项目。
华泰
Attachments do not necessarily have to be embedded inside a RichText field. To quote from the designer-help:
Another source of your problem could be, that there are several "Body" RichText items you would have to check.
HTH
遗憾的是,Lotus Notes 没有提供单一可靠的方法来从 NotesDocument 对象中提取附件。为了彻底检查,您需要检查它包含的所有富文本项目以及文档对象本身。
我编写了以下代码来从邮箱中选定的电子邮件中提取附件,以减少文件大小(我的用户保存了所有内容)。不过,主循环与您的问题相关。它显示了循环遍历文档的所有项目以查找带有附件的富文本项目的过程,然后再次循环遍历所有项目以查找“附件”类型的项目。
(请原谅代码的混乱。它不是为了提高效率而编写的)
Lotus Notes does not provide a single reliable method for extracting attachments from a NotesDocument object, unfortunately. To be thorough, you'll need to check through all richtext items it contains, as well as the document object itself.
I wrote the following code to extract attachments from selected emails in a mailbox, in an effort to cut down the file size (my users saved everything). The main loop is relevant to your question, though. It shows the process of looping through all of the document's items looking for richtext items with attachments, followed by a loop through all items again looking for items of type "Attachment".
(forgive the hackiness of the code. It wasn't written for efficiency)
如果您从
Document
对象获取嵌入对象,它们将不包含附件。将getEmbeddedObjects
与“Body”RichTextItem
一起使用也可以获取附件。这有帮助吗?
If you get the embedded objects from the
Document
object, they won't contain attachments. UsinggetEmbeddedObjects
with the "Body"RichTextItem
gets the attachments too.Does that help?