This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 30, 2011, 8:49 PM
9 Posts

Re: Accessing file attachments stored in richtext field

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer,Administrator
  • Tags:
  • Replies: 2
Through an amount of brute-force & ignorance I have solved my first problem and I can now reference all the files attached to my document and extract the file names. I can even take one of those files and attach it to my outbound email message. What I can't yet do it to is get the extractFile method to accept a variable name so that I can process it in a loop.
 
if (document1.getAttachmentList("Body").isEmpty()){
attachmentNames = "No Files Yet";
} else {
var v = document1.getAttachmentList("Body");

for (i=0; i < v.length; i++){
var eo:NotesEmbeddedObject = v.get(i);
attachmentNames = attachmentNames + eo.getName();
var att1:NotesEmbeddedObject = courseDoc.getAttachment(eo.getName());
filepath$ = "d:\\temp\\xsp\\" + attachmentNames;
 
att1.extractFile(filepath$); <======= if I use a var here it doesn't work, if I code the name explicitly it works fine

sessionScope.put("att"+i,eo.getName());
}
}
 
Generates the error Script interpreter error, line=15, col=6: [TypeError] Exception occurred calling method NotesEmbeddedObject.extractFile(string) null
 
I've tried various ways to build the variable but no luck yet. Any clues???? 
Mar 31, 2011, 9:55 AM
9 Posts
Re: Accessing file attachments stored in richtext field
 Solved - thank heavens for Google!!
 
if (document1.getAttachmentList("Body").isEmpty()){
attachmentNames = "No Files Yet";
} else {
var v = document1.getAttachmentList("Body");

for (i=0; i < v.length; i++){
var eo:NotesEmbeddedObject = v.get(i);
attachmentNames = attachmentNames + eo.getName();
var att1:NotesEmbeddedObject = courseDoc.getAttachment(eo.getName());
att1.extractFile("D:\\temp\\" + eo.getName());       <============= Dumb blindness prevented me from seeing the obvious

sessionScope.put("att"+i,eo.getName());
}

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal