Fórumok

Creating user's specific folders in document library

thumbnail
Praveen P, módosítva 11 év-val korábban

Creating user's specific folders in document library

Regular Member Bejegyzések: 100 Csatlakozás dátuma: 2012.02.21. Legújabb bejegyzések
Hello every one

how to create a user specific folder in document library in liferay 6.1? because my plan is to create separate folders for every users and so that they can upload their images and get its image gallery. so how to create user specific folders programmatically? what services i want to make use?


Thanks in advance
Praveen
thumbnail
Praveen P, módosítva 11 év-val korábban

RE: Creating user's specific folders in document library

Regular Member Bejegyzések: 100 Csatlakozás dátuma: 2012.02.21. Legújabb bejegyzések
Atleast help me to create a folder in document and media by program. and i want to maintain a each user's specific folders like image gallery, or photos in facebook so that users can have their own album in their account but not getting how to create a folder???????????

If anybody knows about it, if possible let me know how to do?

Thanks
thumbnail
Rajeeva Lochana .B.R, módosítva 11 év-val korábban

RE: Creating user's specific folders in document library

Junior Member Bejegyzések: 67 Csatlakozás dátuma: 2010.01.04. Legújabb bejegyzések
Hi Praveen,

Check the below example to create user specific folder.
To achieve this functionality create hook, extend the business logic.

Necessary import class


import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
import com.liferay.portal.kernel.repository.model.Folder;


Code :


ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long repositoryId = themeDisplay.getScopeGroupId();    		
    	
ServiceContext serviceContext = ServiceContextFactory.getInstance(DLFileShortcut.class.getName(), actionRequest);

	//DLAppServiceUtil.addFolder(long repositoryId, long parentFolderId, String name, String description, ServiceContext serviceContext);
Folder folder = DLAppServiceUtil.addFolder(repositoryId, 0l, user.getUserId(), "dummy description", serviceContext);



If you have any concern let me know.

Thanks and Regards,
Rajeeva Lochana.b.R
thumbnail
Praveen P, módosítva 11 év-val korábban

RE: Creating user's specific folders in document library

Regular Member Bejegyzések: 100 Csatlakozás dátuma: 2012.02.21. Legújabb bejegyzések
Hi rajeev Thanks for your replay, I am not getting which service i have to invoke while creating hook, can u mention it in detail?
thumbnail
Rajeeva Lochana .B.R, módosítva 11 év-val korábban

RE: Creating user's specific folders in document library

Junior Member Bejegyzések: 67 Csatlakozás dátuma: 2010.01.04. Legújabb bejegyzések
Hi Praveen,


Find the attached hook example,I have tested, it is working fine, before deploy just change the repositoryId
Check point for the repositoryId : goto control panel >> sites >> click Action button >> Edit Settings .
Site ID : 10180(for Example).
Hard coding the repositoryId is not a good solution for testing purpose i am creating this.
change the code base on your requirement.


Thanks and Regards,
Rajeeva Lochana.B.R
thumbnail
Praveen P, módosítva 11 év-val korábban

RE: Creating user's specific folders in document library

Regular Member Bejegyzések: 100 Csatlakozás dátuma: 2012.02.21. Legújabb bejegyzések
hi i am getting exception which is

Failed to connect to a valid mail server. Please make sure one is properly configured. Could not connect to SMTP host: localhost, port: 25
com.liferay.portal.security.auth.PrincipalException
thumbnail
Praveen P, módosítva 11 év-val korábban

RE: Creating user's specific folders in document library

Regular Member Bejegyzések: 100 Csatlakozás dátuma: 2012.02.21. Legújabb bejegyzések
Getting the error
Failed to connect to a valid mail server. Please make sure one is properly configured. Could not connect to SMTP host: localhost, port: 25


How to rectify it? account is creating but its not creating any folders in user's document library emoticon what is the need of connecting to SMTP here?????????
My intention is to create a folder inside document and media by default while user is creating a account. but with the above code, folder is not creating but user account is creating..........!
thumbnail
Praveen P, módosítva 11 év-val korábban

RE: Creating user's specific folders in document library

Regular Member Bejegyzések: 100 Csatlakozás dátuma: 2012.02.21. Legújabb bejegyzések
Hi rajeeva

No RepositoryEntry exists with the primary key 14002(userID)


Its showing error with this reason, and temporarily not available.
mustang18 Rodríguez, módosítva 5 év-val korábban

RE: Creating user's specific folders in document library

New Member Bejegyzés: 1 Csatlakozás dátuma: 2018.01.19. Legújabb bejegyzések
thumbnail
Andrew Jardine, módosítva 5 év-val korábban

RE: Creating user's specific folders in document library

Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések

depending on what version of the product you are using, the package for the class you are looking for will change. In fact, if you are using Liferay 7, then the way you reference the service will change (or should change) as well.

 

The original post was a question for 6.1 -- Which version of the product are you on?