I’m Having trouble detaching a file from an RTF. Here’s my code…
Although I have the _inputFileName identified as a String above, and have it in the field called FileName, I’m still getting FileName: Null through my debug lines.
void detachFile() {
String _inputFileName = “”; // gwl a
try {
boolean saveFlag = false;
_inputFileName = thisDoc.getItemValueString("FileName");
RichTextItem body = (RichTextItem)thisDoc.getFirstItem("$File");
if (trace) System.out.println("Item name: " +body.getName());
Vector v = body.getEmbeddedObjects();
Enumeration e = v.elements();
while (e.hasMoreElements()) {
EmbeddedObject eo = (EmbeddedObject)e.nextElement();
if (eo.getType() == EmbeddedObject.EMBED_ATTACHMENT) {
eo.extractFile( _inputFileName );
// now we'll remove the file from the Notes Document...
eo.remove();
saveFlag = true;
}
if (saveFlag) {
thisDoc.save(true, true);
saveFlag = false;
}
}
} catch(NotesException e) {
System.out.println(e.id + " " + e.text);
e.printStackTrace();
}catch(Exception e) {
e.printStackTrace();
}
} //detachFile()
I pretty much took this from the help file. Can someone help me get this working? I also have to understand exactly where the server puts this file when we detach it. Is it in the folder (directory) that the NSF is in?
Help!
Marcus