Through my own custom listener I would like to delete main files and attachment from the nuxeo document.
Deleting the document seems to be easy as you can use the below code.
doc.getCoreSession().removeDocument(doc.getRef());
doc.getCoreSession().save();
But how I can delete the file and attachment through my java code. Please provide me a snippet of code.
The code will be..
DocumentHelper.removeProperty(documentModel, path);
path = file:content for main file. For attachment "files/content[array index]"
Related
I need to attach a file generated by Apache POI on an Xpage to a notes document. I have been attempting to implement a solution as suggested by Knut Herrmann:
var temp = java.lang.System.getProperty("java.io.tmpdir");
var file = new java.io.File(temp + "YourFile.docx");
var fileOutputStream = new java.io.FileOutputStream(file);
xwpfdocument.write(fileOutputStream);
fileOutputStream.close();
var doc:NotesDocument = currentDocument.getDocument();
var rdoc:NotesDocument = database.createDocument();
rdoc.appendItemValue("Form", "frmRespTempl");
rdoc.appendItemValue("Subject", "Embedded Word Document");
var rtitem:RichTextItem = rdoc.createRichTextItem("Body");
rtitem.embedObject(lotus.domino.local.EmbeddedObject.EMBED_ATTACHMENT,"",file.getAbsolutePath(), null);
rdoc.makeResponse(doc);
rdoc.save();
POI for XPages - save Word document as attachment in rich text field
however, in order to make xwpfdocument.write(fileOutputStream) work, the java policy file needs to be modified which is a security risk.
I had no luck making the java solutions work either. Is there any other way to go about making this code work? What exactly is the risk of modifying the java policy?
Thanks
Are you running the code in a browser or in the Notes Client because the code will never work in a browser if you want to send the file to the user side. It will work on the serverside.
If you want to attach a local document in a Notes client I would suggest you start an Notes agent with the code to embed the file instead.
Instead of modifying the java.policy file, I think you could
write a class that you implement inside a jar file and place that jar file in the class path on the server and instance it from your XPage code.
I tried to add embed = true in project xml like this:
<assets embed="true" path="Assets" rename="assets" include="*" exclude="openfl.svg" />
But if I try to delete an image from assets folder, then run the exe file, the image will not be displayed, thus, it still loaded form assets folder.
Can some one help?
Thanks every body, I found the answer of Joshua here Embeding and reading image assets when deploying to Windows
But who to know where to read about the answer in the openFL documentation?
I have a .pdf document in a folder called docs, that is inside of my WebContent folder.
I want to have a link to show the address to this file, so that when the user click it, he can see the document's content.
The code is this:
See document
When I execute it, I get the error:
HTTP Status 404 - /Web/docs/jsftutorial.pdf
I tested this with a .txt file, and it works, but why not with a .pdf?
Thank you!!
I found a tutorial on how to Read and open the PDF in a new browser window here:
http://balusc.blogspot.com.br/2006/05/pdf-handling.html
Now it works!
html contents are coming from the server in a xml file. i have seprated the html contents from xml now i want to save these contents to a html file. Please help me regarding this.
Would take only one line in C#: System.IO.File.WriteAllText( System.Environment.SpecialFolder.CommonDocuments + "myhtmlfile.html", "<html>...</html>", System.Text.Encoding.UTF8 );
We have a SharePoint Document library, where we store html files with links to external files. Samples:
mypicture.jpg.html
mywordfile.docx.html
mypdffile.pdf.html
and so on. Now by default all Files show up with the HTML Icon, referenced in the DOCICON.XML file. Thats of course correct as the .html extension shows, it is a HTML file. But we want the files to have different icons, based on their original file type.
Is there a way to automatically change the Icon
during rendering or
when we save the file to the library (via SharePoint API)?
Any other approachs?
Why not use a little jquery to change the icon during rendering? Each doc in your library should be contained in
<td class="ms-vb-icon"><a tabindex=...><img ... src="/_layouts/images/ichtm.gif"></a></td>
I think you can slurp that into an array, assign a new var that's just the href stripped of path/filename. and .html, and use that to replace htm in the src tag.
Could you not just edit the DOCICON.xml to add the ".jpg.html" and ".docx.html" extensions in?
For a full listing of icon files see all "ic*.gif" files in the TEMPLATE\IMAGES directory under the 12 hive. Unfortunately, this will not solve your problem, but this is where you can change it based on the extension, if you so choose.
Note that a blog I wrote a while back has a different focus, but does discuss where the icons come from: http://wiki.threewill.com/display/is/2007/10/14/External+Link+for+Editing+a+SharePoint+Document.