Fórum

Get Folder Id with Folder Name

Guru k, modificado 12 Anos atrás.

Get Folder Id with Folder Name

Junior Member Postagens: 64 Data de Entrada: 08/02/12 Postagens Recentes
Hi,

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

Thanks
Guru
thumbnail
Natalie D, modificado 12 Anos atrás.

RE: Get Folder Id with Folder Name

Junior Member Postagens: 55 Data de Entrada: 06/02/12 Postagens Recentes
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


Long parentFolderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
DLFolder dir = DLFolderLocalServiceUtil.getFolder(groupId, parentFolderId, dirName);
Guru k, modificado 12 Anos atrás.

RE: Get Folder Id with Folder Name

Junior Member Postagens: 64 Data de Entrada: 08/02/12 Postagens Recentes
Hi Natalie, Juhi

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

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


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

Thanks
thumbnail
Juhi Kumari, modificado 12 Anos atrás.

RE: Get Folder Id with Folder Name

Expert Postagens: 347 Data de Entrada: 12/12/11 Postagens Recentes
Hi Guru,
List<dlfolder> dlFolders = DLFolderLocalServiceUtil.getDLFolders(
					0, DLFolderLocalServiceUtil.getDLFoldersCount());
for (DLFolder folder : dlFolders) {
     System.out.println("Folder Id &gt;&gt; "+folder.getFolderId());
      System.out.println("Folder Name &gt;&gt;"+folder.getName());
}</dlfolder>


Regards
Juhi