How to get the path of all the folders of the sites?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member

How to get the path of all the folders of the sites?

Jump to solution

I need to get the path of all folders present in alfresco sites.

Could someone please help me?

1 Solution

Accepted Solutions
Moderator
Moderator

Re: How to get the path of all the folders of the sites?

Jump 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());
}

View solution in original post

2 Replies
Moderator
Moderator

Re: How to get the path of all the folders of the sites?

Jump 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());
}

View solution in original post

Highlighted
Active Member

Re: How to get the path of all the folders of the sites?

Jump to solution

Thank you, I will try.