mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
folder creation cleanup
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@306 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
43ddbaf8e2
commit
1fd0964f78
@ -14,7 +14,6 @@ import org.apache.webdav.lib.ResponseEntity;
|
|||||||
import org.apache.webdav.lib.WebdavResource;
|
import org.apache.webdav.lib.WebdavResource;
|
||||||
import org.apache.webdav.lib.methods.PropPatchMethod;
|
import org.apache.webdav.lib.methods.PropPatchMethod;
|
||||||
import org.apache.webdav.lib.methods.SearchMethod;
|
import org.apache.webdav.lib.methods.SearchMethod;
|
||||||
import org.apache.webdav.lib.methods.MkcolMethod;
|
|
||||||
import org.htmlcleaner.CommentToken;
|
import org.htmlcleaner.CommentToken;
|
||||||
import org.htmlcleaner.HtmlCleaner;
|
import org.htmlcleaner.HtmlCleaner;
|
||||||
import org.htmlcleaner.TagNode;
|
import org.htmlcleaner.TagNode;
|
||||||
@ -772,7 +771,7 @@ public class ExchangeSession {
|
|||||||
} else if (folderName.startsWith("Sent")) {
|
} else if (folderName.startsWith("Sent")) {
|
||||||
folderPath = folderName.replaceFirst("Sent", sentitemsUrl);
|
folderPath = folderName.replaceFirst("Sent", sentitemsUrl);
|
||||||
// absolute folder path
|
// absolute folder path
|
||||||
} else if (folderName != null && folderName.startsWith("/")) {
|
} else if (folderName.startsWith("/")) {
|
||||||
folderPath = folderName;
|
folderPath = folderName;
|
||||||
} else {
|
} else {
|
||||||
folderPath = mailPath + folderName;
|
folderPath = mailPath + folderName;
|
||||||
@ -808,15 +807,12 @@ public class ExchangeSession {
|
|||||||
|
|
||||||
public void createFolder(String folderName) throws IOException {
|
public void createFolder(String folderName) throws IOException {
|
||||||
String folderPath = getFolderPath(folderName);
|
String folderPath = getFolderPath(folderName);
|
||||||
int index = folderPath.lastIndexOf("/");
|
|
||||||
|
|
||||||
PropPatchMethod method = new PropPatchMethod(folderPath) {
|
PropPatchMethod method = new PropPatchMethod(folderPath) {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "MKCOL";
|
return "MKCOL";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
method.setDebug(4);
|
method.addPropertyToSet("outlookfolderclass", "IPF.Note", "ex", "http://schemas.microsoft.com/exchange/");
|
||||||
method.addPropertyToSet("outlookfolderclass","IPF.Note","ex","http://schemas.microsoft.com/exchange/");
|
|
||||||
wdr.retrieveSessionInstance().executeMethod(method);
|
wdr.retrieveSessionInstance().executeMethod(method);
|
||||||
// ok or alredy exists
|
// ok or alredy exists
|
||||||
if (method.getStatusCode() != HttpStatus.SC_MULTI_STATUS && method.getStatusCode() != HttpStatus.SC_METHOD_NOT_ALLOWED) {
|
if (method.getStatusCode() != HttpStatus.SC_MULTI_STATUS && method.getStatusCode() != HttpStatus.SC_METHOD_NOT_ALLOWED) {
|
||||||
@ -825,20 +821,6 @@ public class ExchangeSession {
|
|||||||
ex.setReason(method.getStatusText());
|
ex.setReason(method.getStatusText());
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
PostMethod postMethod = new PostMethod(folderPath.substring(0, index));
|
|
||||||
postMethod.addParameter("Cmd", "createfolder");
|
|
||||||
postMethod.addParameter("Action", "Create");
|
|
||||||
postMethod.addParameter("FolderName", folderPath.substring(index + 1));
|
|
||||||
postMethod.addParameter("FolderType", "IPF.Note");
|
|
||||||
wdr.retrieveSessionInstance().executeMethod(postMethod);
|
|
||||||
if (postMethod.getStatusCode() != HttpStatus.SC_MOVED_TEMPORARILY) {
|
|
||||||
HttpException ex = new HttpException();
|
|
||||||
ex.setReasonCode(postMethod.getStatusCode());
|
|
||||||
ex.setReason(postMethod.getStatusText());
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Folder {
|
public static class Folder {
|
||||||
|
Loading…
Reference in New Issue
Block a user