EWS: take paging into account in appendSubFolders
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2311 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
61dbe7129d
commit
15fd928588
|
@ -1131,27 +1131,30 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||||
protected void appendSubFolders(List<ExchangeSession.Folder> folders,
|
protected void appendSubFolders(List<ExchangeSession.Folder> folders,
|
||||||
String parentFolderPath, FolderId parentFolderId,
|
String parentFolderPath, FolderId parentFolderId,
|
||||||
Condition condition, boolean recursive) throws IOException {
|
Condition condition, boolean recursive) throws IOException {
|
||||||
FindFolderMethod findFolderMethod = new FindFolderMethod(FolderQueryTraversal.SHALLOW,
|
FindFolderMethod findFolderMethod;
|
||||||
BaseShape.ID_ONLY, parentFolderId, FOLDER_PROPERTIES, (SearchExpression) condition);
|
do {
|
||||||
executeMethod(findFolderMethod);
|
findFolderMethod = new FindFolderMethod(FolderQueryTraversal.SHALLOW,
|
||||||
for (EWSMethod.Item item : findFolderMethod.getResponseItems()) {
|
BaseShape.ID_ONLY, parentFolderId, FOLDER_PROPERTIES, (SearchExpression) condition);
|
||||||
Folder folder = buildFolder(item);
|
executeMethod(findFolderMethod);
|
||||||
if (parentFolderPath.length() > 0) {
|
for (EWSMethod.Item item : findFolderMethod.getResponseItems()) {
|
||||||
if (parentFolderPath.endsWith("/")) {
|
Folder folder = buildFolder(item);
|
||||||
folder.folderPath = parentFolderPath + item.get(Field.get("folderDisplayName").getResponseName());
|
if (parentFolderPath.length() > 0) {
|
||||||
|
if (parentFolderPath.endsWith("/")) {
|
||||||
|
folder.folderPath = parentFolderPath + item.get(Field.get("folderDisplayName").getResponseName());
|
||||||
|
} else {
|
||||||
|
folder.folderPath = parentFolderPath + '/' + item.get(Field.get("folderDisplayName").getResponseName());
|
||||||
|
}
|
||||||
|
} else if (folderIdMap.get(folder.folderId.value) != null) {
|
||||||
|
folder.folderPath = folderIdMap.get(folder.folderId.value);
|
||||||
} else {
|
} else {
|
||||||
folder.folderPath = parentFolderPath + '/' + item.get(Field.get("folderDisplayName").getResponseName());
|
folder.folderPath = item.get(Field.get("folderDisplayName").getResponseName());
|
||||||
|
}
|
||||||
|
folders.add(folder);
|
||||||
|
if (recursive && folder.hasChildren) {
|
||||||
|
appendSubFolders(folders, folder.folderPath, folder.folderId, condition, recursive);
|
||||||
}
|
}
|
||||||
} else if (folderIdMap.get(folder.folderId.value) != null) {
|
|
||||||
folder.folderPath = folderIdMap.get(folder.folderId.value);
|
|
||||||
} else {
|
|
||||||
folder.folderPath = item.get(Field.get("folderDisplayName").getResponseName());
|
|
||||||
}
|
}
|
||||||
folders.add(folder);
|
} while (!(findFolderMethod.includesLastItemInRange));
|
||||||
if (recursive && folder.hasChildren) {
|
|
||||||
appendSubFolders(folders, folder.folderPath, folder.folderId, condition, recursive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue