Apr 12, 2013 1:42 PM
67 Posts

Embedded file with substitution name

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 2
Hi,
 
to use an attachment in a special field of a document at another place, i need to calculate the complete URL to that i.e.:
 
...DBPath.../x/A7D0AFC10F1A8C58C12579D10052E5A2/$file/ATT3UVJN.png
 
I'm able to extract the attachment name in a Field with SSJS: 
 
var alist = document1.getAttachmentList("Field");
var alisti = alist.iterator();
while (alisti.hasNext()) 
{
result =alisti.next().getName();
}
return "...documentID.../$FILE/" + result
  
The problem is, that the real attachment name somtimes is  substituted (as seen in the example above).
My question is: 
 
How can i get the substitute name of a specific attachment ?? 
 
Thanks 
Uwe 

Apr 15, 2013 10:14 AM
54 Posts
Re: Embedded file with substitution name
try this:

doc = document1.getDocument();
rtitem = doc.getFirstItem("Body");
v = rtitem.getEmbeddedObjects();
for (var i = 0; i < v.length; i++) {
    print(v[i]);

Apr 18, 2013 3:16 PM
67 Posts
Re: Embedded file with substitution name
 Helmut, that seems to be not a good idea.

When i try your code on a field with substituted attachment names, after execution the http server gets ill:

Exception

java.io.NotSerializableException: lotus.domino.local.EmbeddedObject
lotus.domino.local.EmbeddedObject


 This occurs after that on ALL xpages, regardless if they are involved or not. I have to do a restart of the http-task.
On a field with original  attachment names, there is no problem.