Create folders and sub folders from portlet componentCreate folders and sub folders from portlet componenthttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1211745042024-03-28T17:37:56Z2024-03-28T17:37:56ZRE: Create folders and sub folders from portlet componentOlaf Kockhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1211845402021-10-05T07:36:07Z2021-10-05T07:36:07Z<p>Please don't crosspost. I've deleted your other, identical post.
Here's what I originally answered there:</p>
<div class="c-mt-2">
<div class="questions-article-body-121184506">
<div>
<p>Document Library is the place where binary data goes. Web
Content is a specific type of content that has nothing to do
with binary (or other) uploaded files.</p>
<p>I can't imagine any business requirement where the storage
place is specified. I can imagine a <em>presentation</em>
requirement, but that has nothing to do with the storage
location of documents.</p>
<p>In other words: You didn't find anything because there's no
way. You also wouldn't try to buy groceries in the electronics
store just because somebody told you so. This is comparable.</p>
<p>If you let us know about the underlying business problem that
you're trying to solve, we might generate ideas how to
design/implement. Just make sure they're business language, not
implementation details.</p></div></div></div>Olaf Kock2021-10-05T07:36:07ZRE: Create folders and sub folders from portlet componentAbdul Kareemhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1211773882021-10-01T12:47:21Z2021-10-01T12:47:21Z<p>Hi Shiva,</p>
<p>Firstly decide whether you want to create folders under Web content
or Documents and Media library.</p>
<p>If under web content use :</p>
<p>@Reference<br /> private JournalFolderLocalService journalFolderLocalService;</p>
<p>JournalFolder journalFolder =
journalFolderLocalService.addFolder(themeDisplay.getUserId(),
groupId, <br /> parentFolderId,
folderName, "", serviceContext);</p>
<p>If under Documents and Media then use :</p>
<p>DLFolderLocalServiceUtil.addFolder(userId, groupId, <br />
repositoryId, mountPoint, parentFolderId,
name, description, hidden, serviceContext)</p>Abdul Kareem2021-10-01T12:47:21ZCreate folders and sub folders from portlet componentshiva xchttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1211745032021-09-29T16:17:51Z2021-09-29T16:07:29Z<p>Hello Liferay Community,</p>
<blockquote>
<p>liferay-ce-portal-7.3.3-ga4</p></blockquote>
<p>I have a requirement to read excel data and put it under web content
and sort them into different folders and subfolders. How to do achieve this?</p>
<p>All I found is creating files and folders under Documents and Media library</p>
<ul>
<li>
<a href="https://help.liferay.com/hc/en-us/articles/360029045451-Creating-Files-Folders-and-Shortcuts">https://help.liferay.com/hc/en-us/articles/360029045451-Creating-Files-Folders-and-Shortcuts</a></li>
<li>
<a href="https://help.liferay.com/hc/en-us/articles/360028725672-Creating-Folders">https://help.liferay.com/hc/en-us/articles/360028725672-Creating-Folders</a></li></ul>
<p>Follow these steps to create a folder with the <code>DLAppService</code> method <code>addFolder</code>:</p>
<ol>
<li>
<p>Get a reference to <code>DLAppService</code>:</p>
<pre>
<code>@Reference
private DLAppService _dlAppService;
</code></pre></li>
<li>
<p>Get the data needed to populate
the <code>addFolder</code> 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 <code>javax.portlet.ActionRequest</code> and <a href="https://docs.liferay.com/dxp/portal/7.2-latest/javadocs/portal-kernel/com/liferay/portal/kernel/util/ParamUtil.html"><code>ParamUtil</code></a>:</p>
<pre>
<code>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);
</code></pre></li></ol>
<ol>
<li>
<p>Call the service reference’s <code>addFolder</code> method with
the data from the previous step:</p>
<pre>
<code>Folder folder = _dlAppService.addFolder(
repositoryId, parentFolderId, name, description,
serviceContext);
</code></pre>
<p>The method returns a <code>Folder</code> object, which this
example sets to a variable for later use. Note, however, that you
don’t have to do this.</p></li></ol>
<p> </p>
<p>Please let me know or guide me on how to solve th