Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
how to create a folder inside a folder in document library?
my Requirement is:
Adding Parent folders, Child folders and Their files to Document and Library from Particular location.
Case-1: If Folder is already exists then get that id and add file
( Here I am using
addFileEntry(repositoryId, folderId,sourceFileName, mimeType, title, description, changeLog, is, size, serviceContext) of DLAppServiceUtil class ).
Case-2: If Folder is not exits add folder then add file
(Here I am using for adding folder
addFolder() method of DLAppServiceUtil class)
Adding Parent folders, Child folders and Their files to Document and Library from Particular location.
Case-1: If Folder is already exists then get that id and add file
( Here I am using
addFileEntry(repositoryId, folderId,sourceFileName, mimeType, title, description, changeLog, is, size, serviceContext) of DLAppServiceUtil class ).
Case-2: If Folder is not exits add folder then add file
(Here I am using for adding folder
addFolder() method of DLAppServiceUtil class)
This is Out of Box functionality available , once you click on any folder it will show option to add Subfolder in it.
means liferay does not provide this type of functionality?
Hi sudheer,
Which version of Liferay you are using? I can add Subfolder by clicking on the Action button in Document Library portlet in 6.0.12 and I can add subfolder as well in 6.1.20 but there isn't document library portlet.
Best,
Anna
Which version of Liferay you are using? I can add Subfolder by clicking on the Action button in Document Library portlet in 6.0.12 and I can add subfolder as well in 6.1.20 but there isn't document library portlet.
Best,
Anna
iam using liferay 6.1
Krzysztof Gołębiowski, modified 12 Years ago.
Liferay Master
Posts: 549
Join Date: 6/25/11
Recent Posts
Use this to get folder if it does exists or create if not:
try {
folder = DLFolderLocalServiceUtil.getFolder(
groupId, parentFolderId, folderName);
} catch(NoSuchFolderException e) {
_log.info("Folder '" + folderName + "' for groupId: " + groupId + " does not exists. Creating...");
try {
folder = DLFolderLocalServiceUtil.addFolder(this.getUserId(), groupId, this.getRepositoryId(groupId),
false, parentFolderId, folderName, folderName, this.getServiceContext());
} catch(PortalException e2) {
throw new PortalException("Error while creating '" + folderName +
"' folder for groupId: " + groupId + ", parentFolderId: " + parentFolderId, e2);
}
}
parentFolderId in case of ROOT folder is 0.
Regards,
KG
try {
folder = DLFolderLocalServiceUtil.getFolder(
groupId, parentFolderId, folderName);
} catch(NoSuchFolderException e) {
_log.info("Folder '" + folderName + "' for groupId: " + groupId + " does not exists. Creating...");
try {
folder = DLFolderLocalServiceUtil.addFolder(this.getUserId(), groupId, this.getRepositoryId(groupId),
false, parentFolderId, folderName, folderName, this.getServiceContext());
} catch(PortalException e2) {
throw new PortalException("Error while creating '" + folderName +
"' folder for groupId: " + groupId + ", parentFolderId: " + parentFolderId, e2);
}
}
parentFolderId in case of ROOT folder is 0.
Regards,
KG
HI
I want ask you two things
you want create from code or from admin screen..
if admin screen go to Document and Medial portlet from conrole panel
and create see following image

If you want from code
use
DLAppLocalServiceUtil
DLAppServiceUtil
or
DLFolderLocalServiceUtil
DLFolderServiceUtil
this clasess provide different methods use appropriate one and create.
I want ask you two things
you want create from code or from admin screen..
if admin screen go to Document and Medial portlet from conrole panel
and create see following image

If you want from code
use
DLAppLocalServiceUtil
DLAppServiceUtil
or
DLFolderLocalServiceUtil
DLFolderServiceUtil
this clasess provide different methods use appropriate one and create.
Out of Box means default functionality of Liferay. Liferay itself provide this functions by default.
Community
Company
Feedback