Fórum

Creating user's specific folders in document library

thumbnail
Praveen P, modificado 11 Anos atrás.

Creating user's specific folders in document library

Regular Member Postagens: 100 Data de Entrada: 21/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Creating user's specific folders in document library

Regular Member Postagens: 100 Data de Entrada: 21/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Creating user's specific folders in document library

Junior Member Postagens: 67 Data de Entrada: 04/01/10 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Creating user's specific folders in document library

Regular Member Postagens: 100 Data de Entrada: 21/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Creating user's specific folders in document library

Junior Member Postagens: 67 Data de Entrada: 04/01/10 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Creating user's specific folders in document library

Regular Member Postagens: 100 Data de Entrada: 21/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Creating user's specific folders in document library

Regular Member Postagens: 100 Data de Entrada: 21/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Creating user's specific folders in document library

Regular Member Postagens: 100 Data de Entrada: 21/02/12 Postagens Recentes
Hi rajeeva

No RepositoryEntry exists with the primary key 14002(userID)


Its showing error with this reason, and temporarily not available.
mustang18 Rodríguez, modificado 5 Anos atrás.

RE: Creating user's specific folders in document library

New Member Mensagem: 1 Data de Entrada: 19/01/18 Postagens Recentes
thumbnail
Andrew Jardine, modificado 5 Anos atrás.

RE: Creating user's specific folders in document library

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes

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?