cancel
Showing results for 
Search instead for 
Did you mean: 

Creating folder

riadhazzouz
Confirmed Champ
Confirmed Champ
1 ACCEPTED ANSWER

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

Hi,

You can create folder inside Company Home using repository service.

Ex.

String folderName = String.valueOf(new Date().getTime());
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, folderName);

nodeService.createNode(repository.getCompanyHome(), ContentModel.ASSOC_CONTAINS,                                QName.createQName(folderName),
          ContentModel.TYPE_FOLDER, props);

Thanks,

Sanjay

View answer in original post

4 REPLIES 4

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

Hi,

You can create folder inside Company Home using repository service.

Ex.

String folderName = String.valueOf(new Date().getTime());
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, folderName);

nodeService.createNode(repository.getCompanyHome(), ContentModel.ASSOC_CONTAINS,                                QName.createQName(folderName),
          ContentModel.TYPE_FOLDER, props);

Thanks,

Sanjay

Hi,
Thanks.
And how can I check a folder existence ?

Hi,

You can use getChildByName() method of NodeService to check that given name folder is exist or not.

Ex.

nodeService.getChildByName(folderNode, ContentModel.ASSOC_CONTAINS,Constants.HELP_DOCUMENTS);

Thanks.