Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Guru k
Get Folder Id with Folder Name
17 aprile 2012 0.06
Risposta

Guru k

Punteggio: Junior Member

Messaggi: 64

Data di Iscrizione: 7 febbraio 2012

Messaggi recenti

Hi,

How to get the Folder id of the folders in the document library with the folder name in document library hook.

Thanks
Guru
Natalie D
RE: Get Folder Id with Folder Name
17 aprile 2012 2.22
Risposta

Natalie D

Punteggio: Junior Member

Messaggi: 55

Data di Iscrizione: 6 febbraio 2012

Messaggi recenti

Guru k:
Hi,

How to get the Folder id of the folders in the document library with the folder name in document library hook.

Thanks
Guru


It isn't that hard with DL API, but of course you have to know in which folder you want to search - because many folders inside different locations can have the same name.
Alternatively you can search recursively, starting from root folder

1
2Long parentFolderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
3DLFolder dir = DLFolderLocalServiceUtil.getFolder(groupId, parentFolderId, dirName);
Juhi Kumari
RE: Get Folder Id with Folder Name
17 aprile 2012 2.26
Risposta

Juhi Kumari

Punteggio: Expert

Messaggi: 346

Data di Iscrizione: 12 dicembre 2011

Messaggi recenti

Hi Guru,
1List<DLFolder> dlFolders = DLFolderLocalServiceUtil.getDLFolders(
2                    0, DLFolderLocalServiceUtil.getDLFoldersCount());
3for (DLFolder folder : dlFolders) {
4     System.out.println("Folder Id >> "+folder.getFolderId());
5      System.out.println("Folder Name >>"+folder.getName());
6}


Regards
Juhi
Guru k
RE: Get Folder Id with Folder Name
18 aprile 2012 22.10
Risposta

Guru k

Punteggio: Junior Member

Messaggi: 64

Data di Iscrizione: 7 febbraio 2012

Messaggi recenti

Hi Natalie, Juhi

Thanks for your help... got the work done with

1Long parentFolderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
2DLFolder dir = DLFolderLocalServiceUtil.getFolder(groupId, parentFolderId, dirName);


as i needing the folder id's of the current group doc lib ...

Thanks