diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 15619691..0e407672 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -2517,7 +2517,7 @@ public abstract class ExchangeSession { * @throws IOException on error */ public List getAllContacts(String folderPath) throws IOException { - return searchContacts(folderPath, ITEM_PROPERTIES, isEqualTo("outlookmessageclass", "IPM.Contact")); + return searchContacts(folderPath, ITEM_PROPERTIES, isEqualTo("outlookmessageclass", "IPM.Contact"), 0); } @@ -2527,10 +2527,11 @@ public abstract class ExchangeSession { * @param folderPath Exchange folder path * @param attributes requested attributes * @param condition Exchange search query + * @param maxCount maximum item count * @return list of contacts * @throws IOException on error */ - public abstract List searchContacts(String folderPath, Set attributes, Condition condition) throws IOException; + public abstract List searchContacts(String folderPath, Set attributes, Condition condition, int maxCount) throws IOException; /** * Search calendar messages in provided folder. diff --git a/src/java/davmail/exchange/dav/DavExchangeSession.java b/src/java/davmail/exchange/dav/DavExchangeSession.java index 18a55fec..2d4dcbda 100644 --- a/src/java/davmail/exchange/dav/DavExchangeSession.java +++ b/src/java/davmail/exchange/dav/DavExchangeSession.java @@ -649,7 +649,7 @@ public class DavExchangeSession extends ExchangeSession { } else if (status == HttpStatus.SC_NOT_FOUND) { LOGGER.debug("Contact not found at " + encodedHref + ", searching permanenturl by urlcompname"); // failover, search item by urlcompname - MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow, 1); if (responses.length == 1) { encodedHref = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "permanenturl"); LOGGER.warn("Contact found, permanenturl is " + encodedHref); @@ -862,7 +862,7 @@ public class DavExchangeSession extends ExchangeSession { } else if (status == HttpStatus.SC_NOT_FOUND) { LOGGER.debug("Event not found at " + encodedHref + ", searching permanenturl by urlcompname"); // failover, search item by urlcompname - MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow, 1); if (responses.length == 1) { encodedHref = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "permanenturl"); LOGGER.warn("Event found, permanenturl is " + encodedHref); @@ -1007,7 +1007,7 @@ public class DavExchangeSession extends ExchangeSession { FolderQueryTraversal mode = (!isPublic && recursive) ? FolderQueryTraversal.Deep : FolderQueryTraversal.Shallow; List folders = new ArrayList(); - MultiStatusResponse[] responses = searchItems(folderPath, FOLDER_PROPERTIES, and(isTrue("isfolder"), isFalse("ishidden"), condition), mode); + MultiStatusResponse[] responses = searchItems(folderPath, FOLDER_PROPERTIES, and(isTrue("isfolder"), isFalse("ishidden"), condition), mode, 0); for (MultiStatusResponse response : responses) { Folder folder = buildFolder(response); @@ -1165,7 +1165,7 @@ public class DavExchangeSession extends ExchangeSession { @Override public MessageList searchMessages(String folderPath, Set attributes, Condition condition) throws IOException { MessageList messages = new MessageList(); - MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"), condition), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"), condition), FolderQueryTraversal.Shallow, 0); for (MultiStatusResponse response : responses) { Message message = buildMessage(response); @@ -1180,11 +1180,11 @@ public class DavExchangeSession extends ExchangeSession { * @inheritDoc */ @Override - public List searchContacts(String folderPath, Set attributes, Condition condition) throws IOException { + public List searchContacts(String folderPath, Set attributes, Condition condition, int maxCount) throws IOException { List contacts = new ArrayList(); MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isEqualTo("outlookmessageclass", "IPM.Contact"), isFalse("isfolder"), isFalse("ishidden"), condition), - FolderQueryTraversal.Shallow); + FolderQueryTraversal.Shallow, maxCount); for (MultiStatusResponse response : responses) { contacts.add(new Contact(response)); } @@ -1194,7 +1194,7 @@ public class DavExchangeSession extends ExchangeSession { @Override public List searchEvents(String folderPath, Set attributes, Condition condition) throws IOException { List events = new ArrayList(); - MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"), condition), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"), condition), FolderQueryTraversal.Shallow, 0); for (MultiStatusResponse response : responses) { String instancetype = getPropertyIfExists(response.getProperties(HttpStatus.SC_OK), "instancetype"); Event event = new Event(response); @@ -1216,7 +1216,8 @@ public class DavExchangeSession extends ExchangeSession { return events; } - protected MultiStatusResponse[] searchItems(String folderPath, Set attributes, Condition condition, FolderQueryTraversal folderQueryTraversal) throws IOException { + protected MultiStatusResponse[] searchItems(String folderPath, Set attributes, Condition condition, + FolderQueryTraversal folderQueryTraversal, int maxCount) throws IOException { String folderUrl = getFolderPath(folderPath); StringBuilder searchRequest = new StringBuilder(); searchRequest.append("SELECT ") @@ -1233,7 +1234,7 @@ public class DavExchangeSession extends ExchangeSession { } DavGatewayTray.debug(new BundleMessage("LOG_SEARCH_QUERY", searchRequest)); return DavGatewayHttpClientFacade.executeSearchMethod( - httpClient, URIUtil.encodePath(folderUrl), searchRequest.toString()); + httpClient, URIUtil.encodePath(folderUrl), searchRequest.toString(), maxCount); } protected static final Set EVENT_REQUEST_PROPERTIES = new HashSet(); @@ -1268,7 +1269,7 @@ public class DavExchangeSession extends ExchangeSession { } catch (HttpNotFoundException e) { LOGGER.debug(itemPath + " not found, searching by urlcompname"); // failover: try to get event by displayname - responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", emlItemName), FolderQueryTraversal.Shallow); + responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", emlItemName), FolderQueryTraversal.Shallow, 1); if (responses.length == 0) { throw new HttpNotFoundException(itemPath + " not found"); } @@ -1278,7 +1279,7 @@ public class DavExchangeSession extends ExchangeSession { String urlcompname = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "urlcompname"); if ("urn:content-classes:person".equals(contentClass)) { // retrieve Contact properties - List contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, isEqualTo("urlcompname", urlcompname)); + List contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, isEqualTo("urlcompname", urlcompname), 1); if (contacts.isEmpty()) { LOGGER.warn("Item found, but unable to build contact"); throw new HttpNotFoundException(itemPath + " not found"); @@ -1454,7 +1455,7 @@ public class DavExchangeSession extends ExchangeSession { Set attributes = new HashSet(); attributes.add("roamingdictionary"); - MultiStatusResponse[] responses = searchItems("/users/" + getEmail() + "/NON_IPM_SUBTREE", attributes, isEqualTo("messageclass", "IPM.Configuration.OWA.UserOptions"), DavExchangeSession.FolderQueryTraversal.Deep); + MultiStatusResponse[] responses = searchItems("/users/" + getEmail() + "/NON_IPM_SUBTREE", attributes, isEqualTo("messageclass", "IPM.Configuration.OWA.UserOptions"), DavExchangeSession.FolderQueryTraversal.Deep, 1); if (responses.length == 1) { byte[] roamingdictionary = getBinaryPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "roamingdictionary"); if (roamingdictionary != null) { diff --git a/src/java/davmail/exchange/ews/EWSMethod.java b/src/java/davmail/exchange/ews/EWSMethod.java index 564c9dbe..6e59ea98 100644 --- a/src/java/davmail/exchange/ews/EWSMethod.java +++ b/src/java/davmail/exchange/ews/EWSMethod.java @@ -55,6 +55,7 @@ public abstract class EWSMethod extends PostMethod { protected Disposal deleteType; protected Set methodOptions; protected ElementOption unresolvedEntry; + protected int maxCount; protected Set updates; @@ -343,6 +344,7 @@ public abstract class EWSMethod extends PostMethod { protected void writeSoapBody(Writer writer) throws IOException { startChanges(writer); writeShape(writer); + writeIndexedPageItemView(writer); writeRestriction(writer); writeParentFolderId(writer); writeToFolderId(writer); @@ -358,7 +360,15 @@ public abstract class EWSMethod extends PostMethod { endChanges(writer); } - private void writeAttachmentId(Writer writer) throws IOException { + protected void writeIndexedPageItemView(Writer writer) throws IOException { + if (maxCount > 0) { + writer.write(""); + } + } + + protected void writeAttachmentId(Writer writer) throws IOException { if (attachmentId != null) { if ("CreateAttachment".equals(methodName)) { writer.write(""); diff --git a/src/java/davmail/exchange/ews/EwsExchangeSession.java b/src/java/davmail/exchange/ews/EwsExchangeSession.java index 628cebbd..945f0b73 100644 --- a/src/java/davmail/exchange/ews/EwsExchangeSession.java +++ b/src/java/davmail/exchange/ews/EwsExchangeSession.java @@ -269,7 +269,7 @@ public class EwsExchangeSession extends ExchangeSession { @Override public MessageList searchMessages(String folderPath, Set attributes, Condition condition) throws IOException { MessageList messages = new MessageList(); - List responses = searchItems(folderPath, attributes, condition, FolderQueryTraversal.SHALLOW); + List responses = searchItems(folderPath, attributes, condition, FolderQueryTraversal.SHALLOW, 0); for (EWSMethod.Item response : responses) { Message message = buildMessage(response); @@ -280,8 +280,8 @@ public class EwsExchangeSession extends ExchangeSession { return messages; } - protected List searchItems(String folderPath, Set attributes, Condition condition, FolderQueryTraversal folderQueryTraversal) throws IOException { - FindItemMethod findItemMethod = new FindItemMethod(folderQueryTraversal, BaseShape.ID_ONLY, getFolderId(folderPath)); + protected List searchItems(String folderPath, Set attributes, Condition condition, FolderQueryTraversal folderQueryTraversal, int maxCount) throws IOException { + FindItemMethod findItemMethod = new FindItemMethod(folderQueryTraversal, BaseShape.ID_ONLY, getFolderId(folderPath), maxCount); for (String attribute : attributes) { findItemMethod.addAdditionalProperty(Field.get(attribute)); } @@ -922,10 +922,10 @@ public class EwsExchangeSession extends ExchangeSession { } @Override - public List searchContacts(String folderPath, Set attributes, Condition condition) throws IOException { + public List searchContacts(String folderPath, Set attributes, Condition condition, int maxCount) throws IOException { List contacts = new ArrayList(); List responses = searchItems(folderPath, attributes, condition, - FolderQueryTraversal.SHALLOW); + FolderQueryTraversal.SHALLOW, maxCount); for (EWSMethod.Item response : responses) { contacts.add(new Contact(response)); @@ -938,7 +938,7 @@ public class EwsExchangeSession extends ExchangeSession { List events = new ArrayList(); List responses = searchItems(folderPath, attributes, condition, - FolderQueryTraversal.SHALLOW); + FolderQueryTraversal.SHALLOW, 0); for (EWSMethod.Item response : responses) { events.add(new Event(response)); } @@ -968,7 +968,7 @@ public class EwsExchangeSession extends ExchangeSession { executeMethod(getItemMethod); item = getItemMethod.getResponseItem(); } else { - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); + List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW, 0); if (!responses.isEmpty()) { item = responses.get(0); } @@ -1039,10 +1039,9 @@ public class EwsExchangeSession extends ExchangeSession { @Override public void deleteItem(String folderPath, String itemName) throws IOException { - String urlcompname = convertItemNameToEML(itemName); - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); - if (!responses.isEmpty()) { - DeleteItemMethod deleteItemMethod = new DeleteItemMethod(new ItemId(responses.get(0)), DeleteType.HardDelete); + EWSMethod.Item item = getEwsItem(folderPath, itemName); + if (item != null) { + DeleteItemMethod deleteItemMethod = new DeleteItemMethod(new ItemId(item), DeleteType.HardDelete); executeMethod(deleteItemMethod); } } @@ -1050,15 +1049,15 @@ public class EwsExchangeSession extends ExchangeSession { @Override public void processItem(String folderPath, String itemName) throws IOException { String urlcompname = convertItemNameToEML(itemName); - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); - if (!responses.isEmpty()) { + EWSMethod.Item item = getEwsItem(folderPath, itemName); + if (item != null) { HashMap localProperties = new HashMap(); localProperties.put("processed", "1"); localProperties.put("read", "1"); UpdateItemMethod updateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly, ConflictResolution.AlwaysOverwrite, SendMeetingInvitationsOrCancellations.SendToNone, - new ItemId(responses.get(0)), buildProperties(localProperties)); + new ItemId(item), buildProperties(localProperties)); executeMethod(updateItemMethod); } } diff --git a/src/java/davmail/exchange/ews/FindItemMethod.java b/src/java/davmail/exchange/ews/FindItemMethod.java index 7c252e7f..d082aff6 100644 --- a/src/java/davmail/exchange/ews/FindItemMethod.java +++ b/src/java/davmail/exchange/ews/FindItemMethod.java @@ -29,11 +29,12 @@ public class FindItemMethod extends EWSMethod { * @param baseShape base item shape * @param parentFolderId parent folder id */ - public FindItemMethod(FolderQueryTraversal traversal, BaseShape baseShape, FolderId parentFolderId) { + public FindItemMethod(FolderQueryTraversal traversal, BaseShape baseShape, FolderId parentFolderId, int maxCount) { super("Item", "FindItem"); this.traversal = traversal; this.baseShape = baseShape; this.parentFolderId = parentFolderId; + this.maxCount = maxCount; } } diff --git a/src/java/davmail/http/DavGatewayHttpClientFacade.java b/src/java/davmail/http/DavGatewayHttpClientFacade.java index d3cf8653..7301e163 100644 --- a/src/java/davmail/http/DavGatewayHttpClientFacade.java +++ b/src/java/davmail/http/DavGatewayHttpClientFacade.java @@ -291,10 +291,12 @@ public final class DavGatewayHttpClientFacade { * @param httpClient http client instance * @param path encoded searched folder path * @param searchRequest (SQL like) search request + * @param maxCount max item count * @return Responses enumeration * @throws IOException on error */ - public static MultiStatusResponse[] executeSearchMethod(HttpClient httpClient, String path, String searchRequest) throws IOException { + public static MultiStatusResponse[] executeSearchMethod(HttpClient httpClient, String path, String searchRequest, + int maxCount) throws IOException { String searchBody = "\n" + "\n" + " " + StringUtil.xmlEncode(searchRequest) + "\n" + @@ -312,6 +314,9 @@ public final class DavGatewayHttpClientFacade { } }; searchMethod.setRequestEntity(new StringRequestEntity(searchBody, "text/xml", "UTF-8")); + if (maxCount > 0) { + searchMethod.addRequestHeader("Range", "rows=0-"+(maxCount-1)); + } return executeMethod(httpClient, searchMethod); } diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index 559f7167..27dbbd39 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -1408,7 +1408,7 @@ public class LdapConnection extends AbstractConnection { Map> results = new HashMap>(); - List contacts = session.searchContacts(ExchangeSession.CONTACTS, contactReturningAttributes, condition); + List contacts = session.searchContacts(ExchangeSession.CONTACTS, contactReturningAttributes, condition, 0); for (ExchangeSession.Contact contact : contacts) { if (contact.get("imapUid") != null) { diff --git a/src/test/davmail/exchange/TestExchangeSessionContact.java b/src/test/davmail/exchange/TestExchangeSessionContact.java index 392ce6f5..6b28284a 100644 --- a/src/test/davmail/exchange/TestExchangeSessionContact.java +++ b/src/test/davmail/exchange/TestExchangeSessionContact.java @@ -39,7 +39,7 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase if (itemName != null) { return (ExchangeSession.Contact) session.getItem("testcontactfolder", itemName); } else { - List contacts = session.searchContacts("testcontactfolder", ExchangeSession.CONTACT_ATTRIBUTES, null); + List contacts = session.searchContacts("testcontactfolder", ExchangeSession.CONTACT_ATTRIBUTES, null, 0); itemName = contacts.get(0).itemName; return contacts.get(0); } diff --git a/src/test/davmail/exchange/TestExchangeSessionSearchContact.java b/src/test/davmail/exchange/TestExchangeSessionSearchContact.java index 60609716..b1bdae55 100644 --- a/src/test/davmail/exchange/TestExchangeSessionSearchContact.java +++ b/src/test/davmail/exchange/TestExchangeSessionSearchContact.java @@ -32,16 +32,22 @@ import java.util.Set; public class TestExchangeSessionSearchContact extends AbstractExchangeSessionTestCase { public void testSearchPublicContacts() throws IOException { String folderPath = Settings.getProperty("davmail.publicContactFolder"); - List contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, null); + List contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, null, 0); int count = 0; for (ExchangeSession.Contact contact : contacts) { System.out.println("Contact " + (++count) + '/' + contacts.size() + session.getItem(folderPath, contact.getName())); } } + public void testSearchPublicContactsRange() throws IOException { + String folderPath = Settings.getProperty("davmail.publicContactFolder"); + List contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, null, 10); + assertEquals(10, contacts.size()); + } + public void testSearchPublicContactsWithPicture() throws IOException { String folderPath = Settings.getProperty("davmail.publicContactFolder"); - List contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, session.isTrue("haspicture")); + List contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, session.isTrue("haspicture"), 0); int count = 0; for (ExchangeSession.Contact contact : contacts) { System.out.println("Contact " + (++count) + '/' + contacts.size() + contact.getBody()); @@ -50,7 +56,7 @@ public class TestExchangeSessionSearchContact extends AbstractExchangeSessionTes } public void testSearchContacts() throws IOException { - List contacts = session.searchContacts(ExchangeSession.CONTACTS, ExchangeSession.CONTACT_ATTRIBUTES, null); + List contacts = session.searchContacts(ExchangeSession.CONTACTS, ExchangeSession.CONTACT_ATTRIBUTES, null, 0); for (ExchangeSession.Contact contact : contacts) { System.out.println(session.getItem(ExchangeSession.CONTACTS, contact.getName())); } @@ -59,7 +65,7 @@ public class TestExchangeSessionSearchContact extends AbstractExchangeSessionTes public void testSearchContactsUidOnly() throws IOException { Set attributes = new HashSet(); attributes.add("uid"); - List contacts = session.searchContacts(ExchangeSession.CONTACTS, attributes, null); + List contacts = session.searchContacts(ExchangeSession.CONTACTS, attributes, null, 0); for (ExchangeSession.Contact contact : contacts) { System.out.println(contact); } @@ -68,9 +74,9 @@ public class TestExchangeSessionSearchContact extends AbstractExchangeSessionTes public void testSearchContactsByUid() throws IOException { Set attributes = new HashSet(); attributes.add("uid"); - List contacts = session.searchContacts(ExchangeSession.CONTACTS, attributes, null); + List contacts = session.searchContacts(ExchangeSession.CONTACTS, attributes, null, 0); for (ExchangeSession.Contact contact : contacts) { - System.out.println(session.searchContacts(ExchangeSession.CONTACTS, attributes, session.isEqualTo("uid", contact.get("uid")))); + System.out.println(session.searchContacts(ExchangeSession.CONTACTS, attributes, session.isEqualTo("uid", contact.get("uid")), 0)); } } diff --git a/src/test/davmail/exchange/dav/TestDavExchangeSession.java b/src/test/davmail/exchange/dav/TestDavExchangeSession.java index e1da9948..d9cf4577 100644 --- a/src/test/davmail/exchange/dav/TestDavExchangeSession.java +++ b/src/test/davmail/exchange/dav/TestDavExchangeSession.java @@ -112,7 +112,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase { Set attributes = new HashSet(); attributes.add("permanenturl"); attributes.add("roamingxmlstream"); - MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.CategoryList")), DavExchangeSession.FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.CategoryList")), DavExchangeSession.FolderQueryTraversal.Shallow, 0); String value = (String) responses[0].getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("roamingxmlstream")).getValue(); String propertyList = new String(Base64.decodeBase64(value.getBytes()), "UTF-8"); System.out.println(propertyList); @@ -127,7 +127,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase { Set attributes = new HashSet(); attributes.add("permanenturl"); attributes.add("roamingxmlstream"); - MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.Calendar")), DavExchangeSession.FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.Calendar")), DavExchangeSession.FolderQueryTraversal.Shallow, 0); String value = (String) responses[0].getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("roamingxmlstream")).getValue(); String propertyList = new String(Base64.decodeBase64(value.getBytes()), "UTF-8"); System.out.println(propertyList); @@ -145,7 +145,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase { attributes.add("roamingxmlstream"); attributes.add("displayname"); - MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + '/', attributes, davSession.and(davSession.isTrue("ishidden")), DavExchangeSession.FolderQueryTraversal.Deep); + MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + '/', attributes, davSession.and(davSession.isTrue("ishidden")), DavExchangeSession.FolderQueryTraversal.Deep, 0); for (MultiStatusResponse response : responses) { System.out.println(response.getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("messageclass")).getValue() + ": " + response.getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("displayname")).getValue()); @@ -171,7 +171,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase { attributes.add("roamingdictionary"); attributes.add("displayname"); - MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/non_ipm_subtree", attributes, davSession.and(davSession.isTrue("ishidden")), DavExchangeSession.FolderQueryTraversal.Deep); + MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/non_ipm_subtree", attributes, davSession.and(davSession.isTrue("ishidden")), DavExchangeSession.FolderQueryTraversal.Deep, 0); for (MultiStatusResponse response : responses) { System.out.println(response.getHref() + ' ' + response.getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("messageclass")).getValue() + ": " + response.getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("displayname")).getValue());