Listing the children of the root/top folder
To get a list of all the content in the top folder in the repository, we first have to get to the top folder, referred to as the root folder. The root folder can be accessed via the session. The top folder in Alfresco is named /Company Home
.
To get the root folder and then a listing of its content, add the following code in a new method named listTopFolder
:
public void listTopFolder(Session session) { Folder root = session.getRootFolder(); ItemIterable<CmisObject> contentItems= root.getChildren(); for (CmisObject contentItem : contentItems) { if (contentItem instanceof Document) { Document docMetadata = (Document)contentItem; ContentStream docContent = docMetadata.getContentStream(); logger.info(docMetadata.getName() + " [size=" + docContent.getLength()+"][Mimetype=" + docContent.getMimeType()+"][type=" + docMetadata.getType().getDisplayName()+"]"); } else { logger.info(contentItem...