I am working on reading excel data in portlet and putting it under Web Content and sorting them into different folders and subfolders.
All I found is creating files and folders under the Documents and Media library but not under the Web Content
https://help.liferay.com/hc/en-us/articles/360029045451-Creating-Files-Folders-and-Shortcuts https://help.liferay.com/hc/en-us/articles/360028725672-Creating-Folders
Follow these steps to create a folder with the DLAppService
method addFolder
:
Get a reference to DLAppService
:
@Reference
private DLAppService _dlAppService;
Get the data needed to populate the addFolder
method’s arguments. Since it’s common to create a folder with data submitted by the end user, you can extract the data from the request. This example does so via javax.portlet.ActionRequest
and ParamUtil
:
long repositoryId = ParamUtil.getLong(actionRequest, "repositoryId");
long parentFolderId = ParamUtil.getLong(actionRequest, "parentFolderId");
String name = ParamUtil.getString(actionRequest, "name");
String description = ParamUtil.getString(actionRequest, "description");
ServiceContext serviceContext = ServiceContextFactory.getInstance(
DLFolder.class.getName(), actionRequest);
Call the service reference’s addFolder method with the data from the previous step:
Folder folder = _dlAppService.addFolder(
repositoryId, parentFolderId, name, description,
serviceContext);
Please let me know or guide me on how to solve this problem.
Thanks in advance.
In the Document Library, you can upload and store documents.
Under Web Content, you can create and store web content articles.
You sound like you want to store documents (e.g. excel files) under Web Content, and that's not what those folders are being built for. Note that this is not a file system, but those are distinct ways to organize the different types of content.
So, the way to solve this problem is to go back to the requirements, and find a working technical solution for the underlying business problem.
Any folder you create through an API with the DL
prefix will appear under the Document Library. Any folder you create through an API starting with a Journal
prefix will appear under Web Content. There simply is no overlap.