Document API - How to correctly update existing documents programmatically?Document API - How to correctly update existing documents programmatically?https://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1199537412024-03-29T15:04:17Z2024-03-29T15:04:17ZRE: Document API - How to correctly update existing documents programmaticaFabian Witthaushttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1199666472020-09-18T07:53:29Z2020-09-18T07:53:29ZThank you. With DLAppService.updateFileEntry(...) it works :-)Fabian Witthaus2020-09-18T07:53:29ZRE: Document API - How to correctly update existing documents programmaticaMohammed Yasinhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1199639182020-09-17T09:18:13Z2020-09-17T09:18:13ZNot redundant , all have there own uses DlFileEntrylocalservice api are for DLFileEntry Entity , DLApp Services should be used for document and media.<br />You can go refer below links for more information<br /><a href="https://help.liferay.com/hc/en-us/articles/360019952312-Getting-Started-with-the-Documents-and-Media-API">https://help.liferay.com/hc/en-us/articles/360019952312-Getting-Started-with-the-Documents-and-Media-API</a><br /><a href="https://help.liferay.com/hc/en-us/articles/360019952332-Creating-Files-Folders-and-Shortcuts">https://help.liferay.com/hc/en-us/articles/360019952332-Creating-Files-Folders-and-Shortcuts</a><br /><a href="https://help.liferay.com/hc/en-us/articles/360020197211-Creating-Files-">https://help.liferay.com/hc/en-us/articles/360020197211-Creating-Files-</a><br /><a href="https://help.liferay.com/hc/en-us/articles/360019952432-Updating-Files">https://help.liferay.com/hc/en-us/articles/360019952432-Updating-Files</a>Mohammed Yasin2020-09-17T09:18:13ZRE: Document API - How to correctly update existing documents programmaticaFabian Witthaushttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1199614262020-09-17T07:57:18Z2020-09-17T07:57:18ZThanks for the reply. So are all these services redundant?Fabian Witthaus2020-09-17T07:57:18ZRE: Document API - How to correctly update existing documents programmaticaMohammed Yasinhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1199541112020-09-16T11:20:25Z2020-09-16T11:20:25Z<html><head></head><body>Hi,<br>Try using DlAppLocalService or DlAppService instead of DlFileEntryLocalService<br><br><pre><code>DLAppLocalService.updateFileEntry(userId, fileEntryId, sourceFileName, mimeType title, description, changeLog DLVersionNumberIncrease.MINOR, file, serviceContext); </code></pre><br><pre><code>&nbsp;DLAppService.updateFileEntry(fileEntryId, sourceFileName, mimeType, title, description, changeLog DLVersionNumberIncrease.MINOR, file, serviceContext); </code></pre></body></html>Mohammed Yasin2020-09-16T11:20:25ZDocument API - How to correctly update existing documents programmatically?Fabian Witthaushttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1199537402020-09-16T10:36:48Z2020-09-16T10:36:48ZI have to develop a portlet for uploading new documents and updating existing ones with Liferay 7.3-ga1. Creating new documents and deleting works fine but I have a problem with updating existing ones.<br /><br />For the update process I use dLFileEntryService.updateFileEntry(...) and dLFileEntryService.updateStatus(...) .<br /><br />updatedEntry = dLFileEntryService.updateFileEntry(...);<br />...<br />dLFileEntryService.updateStatus(<br />user,<br />updatedFileEntry.getFileVersionId(),<br />WorkflowConstants.STATUS_APPROVED,<br />ServiceContextFactory.getInstance(DLFolder.class.getName(), request),<br />new HashMap<>()); // ? Docs say workflowContext<br /><br />If I look as admin into 'documents and media' the new version of the document is displayed there (version counter increases), but still has the status 'draft' and not 'approved'. As result the new version is (of course) not shown