Questions Tagged With ivyhttps://answers.axonivy.com/tags/ivy/?type=rss&user=nvhuongquestions tagged <span class="tag">ivy</span>enSat, 22 Oct 2016 11:06:36 -0400Ivy.wf().documents() - How to update an existing document with new content?https://answers.axonivy.com/questions/2128/ivy-wf-documents-how-to-update-an-existing-document-with-new-content<p>I got an error when trying to update the content for an existing document that's managed by <code>Ivy.wf().documents()</code>. This api doesn't have the method <code>update</code> so I just tried with following code:</p> <p><code>ivy.wf.documents().add("newfolder\\hello.pdf").write().withContentFrom(new File("sourcefolder\\file2.pdf", false));</code></p> <p>The message looks like: </p> <p><code>IOException: File newfolder\hello.pdf already exists PersistencyException: Cannot create file 'D:\work\AxonIvyDesigner6.3.0\files\application\newfolder\hello.pdf' for document 'newfolder\hello.pdf'</code></p> <p>Yeah! it's correct! But, I want to update this existing file with new content.</p> <p>I already tried to use method <code>delete</code> first:</p> <p><code>ivy.wf.documents().delete(new ch.ivyteam.ivy.workflow.document.Path("newfolder\\hello.pdf"));</code></p> <p>Or, trying to delete the physical file; but it did not work.</p> <p>Thanks for your checking!</p>nvhuongSat, 22 Oct 2016 11:06:36 -0400https://answers.axonivy.com/questions/2128/ivy-wf-documents-how-to-update-an-existing-document-with-new-contentdocumentivy