static public string[] GetSubfolders(CmisRepoCredentials credentials, string path) {
List<string> result = new List<string>();
// Connect to the CMIS repository.
Dictionary<string, string> cmisParameters = GetCmisParameters(credentials);
SessionFactory factory = SessionFactory.NewInstance();
ISession session = factory.CreateSession(cmisParameters);
// Get the folder.
IFolder folder;
try {
folder = (IFolder)session.GetObjectByPath(path);
} catch (Exception ex) {
Logger.Warn(string.Format("CmisUtils | exception when session GetObjectByPath for {0}: {1}", path, Utils.ToLogString(ex)));
return result.ToArray();
}
// Debug the properties count, which allows to check whether a particular CMIS implementation is compliant or not.
// For instance, IBM Connections is known to send an illegal count.
Logger.Info("CmisUtils | folder.Properties.Count:" + folder.Properties.Count.ToString());
// Get the folder's sub-folders.
IItemEnumerable<ICmisObject> children = folder.GetChildren();
// Return the full path of each of the sub-folders.
foreach (var subfolder in children.OfType<IFolder>())
{
result.Add(subfolder.Path);
}
return result.ToArray();
}