I have the below findFolder method, when I pass the path I am not able to find the folder. Please can you let me know what the path should be or what is incorrect below.
I have a folder at the path specified.
FindFolder method
public static Folder findFolder(@NotNull Session session, @NotNull String path) throws FolderNotFoundException{
CmisObject obj = session.getObjectByPath(path);
if(obj instanceof Folder){
return (Folder)obj;
}else{
throw new FolderNotFoundException("The path " + path + " does not return reference to a folder");
}
}
Test class
String user = "admin";
String pwd = "admin";
String serviceUrl = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser";
Session session = SessionManager.getInstance().createSession(new SessionContext(user, pwd, serviceUrl));
try {
Folder folder = FolderService.findFolder(session, "/app:company_home/st:sites/cm:testsite/cm:documentLibrary/cm:Contracts");
assertNotNull(folder);
} catch (FolderNotFoundException e) {
e.printStackTrace();
}
Exception
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: /app:company_home/st:sites/cm:test-site/cm:documentLibrary/cm:Contracts
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.convertStatusCode(AbstractBrowserBindingService.java:296)
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.read(AbstractBrowserBindingService.java:410)
Solved! Go to Solution.
"app:company_home" is known as "/" for CMIS.
Try typing "/Sites/Test Site/documentLibrary/Contracts" or so.
"app:company_home" is known as "/" for CMIS.
Try typing "/Sites/Test Site/documentLibrary/Contracts" or so.
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.