From c5ef2d1f15a8d51594f8567ad6a87e9de293b0d4 Mon Sep 17 00:00:00 2001 From: mguessan Date: Mon, 28 Jun 2010 16:26:08 +0000 Subject: [PATCH] DAV: use search expression to request ishidden git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1107 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- .../davmail/exchange/dav/DavExchangeSession.java | 13 ++++++------- src/java/davmail/exchange/dav/Field.java | 13 ++++++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/java/davmail/exchange/dav/DavExchangeSession.java b/src/java/davmail/exchange/dav/DavExchangeSession.java index d324fd2c..27c07a86 100644 --- a/src/java/davmail/exchange/dav/DavExchangeSession.java +++ b/src/java/davmail/exchange/dav/DavExchangeSession.java @@ -1010,7 +1010,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"), condition), mode); + MultiStatusResponse[] responses = searchItems(folderPath, FOLDER_PROPERTIES, and(isTrue("isfolder"), isFalse("ishidden"), condition), mode); for (MultiStatusResponse response : responses) { Folder folder = buildFolder(response); @@ -1135,7 +1135,7 @@ public class DavExchangeSession extends ExchangeSession { @Override public MessageList searchMessages(String folderPath, List attributes, Condition condition) throws IOException { MessageList messages = new MessageList(); - MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"),condition), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"),condition), FolderQueryTraversal.Shallow); for (MultiStatusResponse response : responses) { Message message = buildMessage(response); @@ -1152,7 +1152,7 @@ public class DavExchangeSession extends ExchangeSession { @Override protected List searchContacts(String folderPath, List attributes, Condition condition) throws IOException { List contacts = new ArrayList(); - MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"),condition), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"),condition), FolderQueryTraversal.Shallow); for (MultiStatusResponse response : responses) { contacts.add(new Contact(response)); } @@ -1162,7 +1162,7 @@ public class DavExchangeSession extends ExchangeSession { @Override protected List searchEvents(String folderPath, List attributes, Condition condition) throws IOException { List events = new ArrayList(); - MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"),condition), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"),condition), FolderQueryTraversal.Shallow); for (MultiStatusResponse response : responses) { String instancetype = getPropertyIfExists(response.getProperties(HttpStatus.SC_OK), "instancetype"); Event event = new Event(response); @@ -1195,10 +1195,9 @@ public class DavExchangeSession extends ExchangeSession { searchRequest.append(',').append(Field.getRequestPropertyString(field.getAlias())); } } - searchRequest.append(" FROM SCOPE('").append(folderQueryTraversal).append(" TRAVERSAL OF \"").append(folderUrl).append("\"')") - .append(" WHERE \"DAV:ishidden\" = False"); + searchRequest.append(" FROM SCOPE('").append(folderQueryTraversal).append(" TRAVERSAL OF \"").append(folderUrl).append("\"')"); if (condition != null) { - searchRequest.append(" AND "); + searchRequest.append(" WHERE "); condition.appendTo(searchRequest); } // TODO order by ImapUid diff --git a/src/java/davmail/exchange/dav/Field.java b/src/java/davmail/exchange/dav/Field.java index 01136f1d..2d92bb75 100644 --- a/src/java/davmail/exchange/dav/Field.java +++ b/src/java/davmail/exchange/dav/Field.java @@ -225,6 +225,13 @@ public class Field { createField(URN_SCHEMAS_HTTPMAIL, "textdescription"); // PR_BODY 0x1000 String createField("im", DistinguishedPropertySetType.Address, 0x8062, "im"); // InstantMessagingAddress DistinguishedPropertySetType.Address/0x00008062/String + // OWA settings + createField("messageclass", 0x001a, PropertyType.String); + createField("roamingxmlstream", 0x7c08, PropertyType.Binary); + createField("roamingdictionary", 0x7c07, PropertyType.Binary); + + + createField(DAV, "ishidden"); } protected static void createField(String alias, int propertyTag, PropertyType propertyType) { @@ -316,10 +323,10 @@ public class Field { } /** - * Get Mime header fieks. + * Get Mime header field. * - * @param alias field alias - * @return field + * @param headerName header name + * @return field object */ public static Field getHeader(String headerName) { return new Field(SCHEMAS_MAPI_STRING_INTERNET_HEADERS, headerName);