I've found a way to achieve this, isn't an elegant one but maybe can help to someone, take a look into this code example:
public ChildsSharePointClient getFileClient(String appendPath) {
if (mServices == null || mServices.isEmpty()) {
mCountDownLatch = new CountDownLatch(1);
discoverServices();
try {
mCountDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (mFileServiceInfo == null) {
mFileServiceInfo = getService(Constants.MYFILES_CAPABILITY);
}
String serviceEndpointUri = mFileServiceInfo.getserviceEndpointUri();
String serviceResourceId = mFileServiceInfo.getserviceResourceId();
if (!TextUtils.isEmpty(appendPath)) {
serviceEndpointUri += appendPath;
}
AuthenticationManager.getInstance().setResourceId(serviceResourceId);
DefaultDependencyResolver dependencyResolver = (DefaultDependencyResolver) AuthenticationManager.getInstance()
.getDependencyResolver();
return new ChildsSharePointClient(serviceEndpointUri, dependencyResolver);
}
public List<Item> getFilesList(String folderId) {
List<Item> filesAndFolders = null;
try {
if (TextUtils.isEmpty(folderId)) {
folderId = ROOT_PATH;
}
filesAndFolders = getFileClient(FILES_PATH + "/" + folderId)
.getChilds()
.read()
.get();
LOG.debug("Retrieved {} elements",filesAndFolders.size());
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
return filesAndFolders;
}
/**
* Created by mike on 16/06/15.
*/
public class ChildsSharePointClient extends SharePointClient {
/**
* Instantiates a new SharePointClient.
*
* @param url the url
* @param resolver the resolver
*/
public ChildsSharePointClient(String url, DependencyResolver resolver) {
super(url, resolver);
}
/**
* Gets Item.
*
* @return the Item
*/
public ODataCollectionFetcher<Item, ItemFetcher, ItemCollectionOperations> getChilds() {
return new ODataCollectionFetcher<Item, ItemFetcher,ItemCollectionOperations>("children", this, Item.class,ItemCollectionOperations.class);
}
}
Basically I'm initiating SharePointClient directly with url with id of desired folder and I've added a getChild() action into a class that inherit from MS SharePointClient and request for "children" item.
Hope it helps to someone in the meanwhile we found a more elegant solution.