Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Praveen P
Creating user's specific folders in document library
September 7, 2012 4:21 AM
Answer

Praveen P

Rank: Regular Member

Posts: 100

Join Date: February 20, 2012

Recent Posts

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
Praveen P
RE: Creating user's specific folders in document library
September 10, 2012 12:04 AM
Answer

Praveen P

Rank: Regular Member

Posts: 100

Join Date: February 20, 2012

Recent Posts

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
Rajeeva Lochana .B.R
RE: Creating user's specific folders in document library
September 10, 2012 5:10 AM
Answer

Rajeeva Lochana .B.R

Rank: Junior Member

Posts: 59

Join Date: January 4, 2010

Recent Posts

Hi Praveen,

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

Necessary import class

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


Code :
 1
 2
 3ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
 4long repositoryId = themeDisplay.getScopeGroupId();            
 5       
 6ServiceContext serviceContext = ServiceContextFactory.getInstance(DLFileShortcut.class.getName(), actionRequest);
 7
 8    //DLAppServiceUtil.addFolder(long repositoryId, long parentFolderId, String name, String description, ServiceContext serviceContext);
 9Folder 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
Praveen P
RE: Creating user's specific folders in document library
September 10, 2012 1:22 AM
Answer

Praveen P

Rank: Regular Member

Posts: 100

Join Date: February 20, 2012

Recent Posts

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?
Praveen P
RE: Creating user's specific folders in document library
September 10, 2012 4:36 AM
Answer

Praveen P

Rank: Regular Member

Posts: 100

Join Date: February 20, 2012

Recent Posts

Hi rajeeva

No RepositoryEntry exists with the primary key 14002(userID)


Its showing error with this reason, and temporarily not available.
Rajeeva Lochana .B.R
RE: Creating user's specific folders in document library
September 10, 2012 5:08 AM
Answer

Rajeeva Lochana .B.R

Rank: Junior Member

Posts: 59

Join Date: January 4, 2010

Recent Posts

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
Attachments: usercreation-struts-action-hook-6.1.10.1.war (4.8k)
Praveen P
RE: Creating user's specific folders in document library
September 11, 2012 1:59 AM
Answer

Praveen P

Rank: Regular Member

Posts: 100

Join Date: February 20, 2012

Recent Posts

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
Praveen P
RE: Creating user's specific folders in document library
September 11, 2012 11:39 PM
Answer

Praveen P

Rank: Regular Member

Posts: 100

Join Date: February 20, 2012

Recent Posts

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..........!