@@ -142,6 +142,58 @@ public Folder createFolder(String name) throws ExchangeException {
142
142
}
143
143
144
144
145
+ //**************************************************************************
146
+ //** rename
147
+ //**************************************************************************
148
+ /** Used to rename this folder.
149
+ */
150
+ public void rename (String name ) throws ExchangeException {
151
+ changeKey = getChangeKey (conn );
152
+ name = name .trim ();
153
+ String msg =
154
+ "<?xml version=\" 1.0\" encoding=\" utf-8\" ?>"
155
+ + "<soap:Envelope xmlns:soap=\" http://schemas.xmlsoap.org/soap/envelope/\" xmlns:t=\" http://schemas.microsoft.com/exchange/services/2006/types\" >"
156
+ + "<soap:Body>"
157
+ + "<UpdateFolder xmlns=\" http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\" http://schemas.microsoft.com/exchange/services/2006/types\" >"
158
+ + "<FolderChanges>"
159
+ + "<t:FolderChange>"
160
+ + "<t:FolderId Id=\" " + id + "\" ChangeKey=\" " + changeKey + "\" />"
161
+ + "<t:Updates>"
162
+ + "<t:SetFolderField>"
163
+ + "<t:FieldURI FieldURI=\" folder:DisplayName\" />"
164
+ + "<t:Folder><t:DisplayName>" + name + "</t:DisplayName></t:Folder>"
165
+ + "</t:SetFolderField>"
166
+ + "</t:Updates>"
167
+ + "</t:FolderChange>"
168
+ + "</FolderChanges>"
169
+ + "</UpdateFolder>"
170
+ + "</soap:Body>"
171
+ + "</soap:Envelope>" ;
172
+ conn .execute (msg );
173
+ this .name = name ;
174
+ }
175
+
176
+
177
+ //**************************************************************************
178
+ //** move
179
+ //**************************************************************************
180
+ /** Used to move this folder to another folder.
181
+ */
182
+ public void move (Folder destination ) throws ExchangeException {
183
+ String msg =
184
+ "<?xml version=\" 1.0\" encoding=\" utf-8\" ?>"
185
+ + "<soap:Envelope xmlns:soap=\" http://schemas.xmlsoap.org/soap/envelope/\" xmlns:t=\" http://schemas.microsoft.com/exchange/services/2006/types\" >"
186
+ + "<soap:Body>"
187
+ + "<MoveFolder xmlns=\" http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\" http://schemas.microsoft.com/exchange/services/2006/types\" >"
188
+ + "<ToFolderId><t:FolderId Id=\" " + destination .id + "\" /></ToFolderId>"
189
+ + "<FolderIds><t:FolderId Id=\" " + id + "\" /></FolderIds>"
190
+ + "</MoveFolder>"
191
+ + "</soap:Body>"
192
+ + "</soap:Envelope>" ;
193
+ conn .execute (msg );
194
+ }
195
+
196
+
145
197
//**************************************************************************
146
198
//** delete
147
199
//**************************************************************************
@@ -161,6 +213,16 @@ public void delete() throws ExchangeException {
161
213
}
162
214
163
215
216
+ //**************************************************************************
217
+ //** getChangeKey
218
+ //**************************************************************************
219
+ /** Used to retrieve the latest ChangeKey for this folder. This method is
220
+ * required to update an item.
221
+ */
222
+ protected String getChangeKey (Connection conn ) throws ExchangeException {
223
+ changeKey = new Folder (id , conn ).changeKey ;
224
+ return changeKey ;
225
+ }
164
226
165
227
private void parseXML (org .w3c .dom .Document xml ) throws ExchangeException {
166
228
org .w3c .dom .Node [] nodes = javaxt .xml .DOM .getElementsByTagName ("FolderId" , xml );
0 commit comments