I need to get the path of all folders present in alfresco sites.
Could someone please help me?
Solved! Go to Solution.
First of all perform a search to get the list of folder nodes. Once you have nodeRefs of all the folders.
If you are using javascript, you can use following to get the path.
var displayPathOfANode = node.displayPath;
If you are using java, you can use following to get the path.
nodeService.getPath(nodeRef).toDisplayPath(nodeService, permissionService);
Example:
final String displayPathofANode = getDisplayPath(nodeRef);
private String getDisplayPath(final NodeRef nodeRef) {
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<String>() {
@Override
public String doWork() {
final Path nodePath = this.nodeService.getPath(nodeRef);
return nodePath.toDisplayPath(this.nodeService, this.permissionService);
}
}, AuthenticationUtil.getSystemUserName());
}
First of all perform a search to get the list of folder nodes. Once you have nodeRefs of all the folders.
If you are using javascript, you can use following to get the path.
var displayPathOfANode = node.displayPath;
If you are using java, you can use following to get the path.
nodeService.getPath(nodeRef).toDisplayPath(nodeService, permissionService);
Example:
final String displayPathofANode = getDisplayPath(nodeRef);
private String getDisplayPath(final NodeRef nodeRef) {
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<String>() {
@Override
public String doWork() {
final Path nodePath = this.nodeService.getPath(nodeRef);
return nodePath.toDisplayPath(this.nodeService, this.permissionService);
}
}, AuthenticationUtil.getSystemUserName());
}
Thank you, I will try.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.