@@ -420,7 +420,7 @@ protected org.w3c.dom.Document getItems(int offset, int limit, java.util.HashSet
420
420
*/
421
421
protected org .w3c .dom .Document getItems (String view , java .util .HashSet <FieldURI > additionalProperties , String where , FieldOrder [] sortOrder ) throws ExchangeException {
422
422
423
-
423
+
424
424
//Parse order by statement
425
425
String sort = "" ;
426
426
if (sortOrder !=null ){
@@ -490,7 +490,7 @@ protected org.w3c.dom.Document getItems(String view, java.util.HashSet<FieldURI>
490
490
+ "<t:FieldURI FieldURI=\" item:ItemClass\" />"
491
491
//+ "<t:FieldURI FieldURI=\"item:LastModifiedTime\"/>" //value="item:LastModifiedTime" //<--This doesn't work...
492
492
+ "<t:ExtendedFieldURI PropertyTag=\" 0x3008\" PropertyType=\" SystemTime\" />" //<--This returns the LastModifiedTime!
493
- + props .toString ()
493
+ + props .toString ()
494
494
+ "</t:AdditionalProperties>"
495
495
+ "</m:ItemShape>"
496
496
@@ -504,7 +504,7 @@ protected org.w3c.dom.Document getItems(String view, java.util.HashSet<FieldURI>
504
504
+ "</m:FindItem>"
505
505
+ "</soap:Body>"
506
506
+ "</soap:Envelope>" ;
507
-
507
+
508
508
return conn .execute (msg );
509
509
}
510
510
@@ -517,49 +517,67 @@ protected org.w3c.dom.Document getItems(String view, java.util.HashSet<FieldURI>
517
517
*/
518
518
public java .util .HashMap <String , javaxt .utils .Date > getIndex () throws ExchangeException {
519
519
520
- String msg =
521
- "<?xml version=\" 1.0\" encoding=\" utf-8\" ?>"
522
- + "<soap:Envelope xmlns:soap=\" http://schemas.xmlsoap.org/soap/envelope/\" xmlns:t=\" http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:m=\" http://schemas.microsoft.com/exchange/services/2006/messages\" >"
523
- + "<soap:Body>"
524
- + "<m:FindItem Traversal=\" Shallow\" >"
525
- + "<m:ItemShape>"
526
- + "<t:BaseShape>IdOnly</t:BaseShape>" //<--"Default" vs "AllProperties"
527
- + "<t:AdditionalProperties>"
528
- + "<t:ExtendedFieldURI PropertyTag=\" 0x3008\" PropertyType=\" SystemTime\" />" //<--This returns the LastModifiedTime!
529
- + "</t:AdditionalProperties>"
530
- + "</m:ItemShape>"
531
-
532
- + "<m:SortOrder>"
533
- + "<t:FieldOrder Order=\" Descending\" >"
534
- + "<t:ExtendedFieldURI PropertyTag=\" 0x3008\" PropertyType=\" SystemTime\" />"
535
- + "</t:FieldOrder>"
536
- + "</m:SortOrder>"
537
-
538
- //+ "<m:IndexedPageItemView MaxEntriesReturned=\"1\" Offset=\"0\" BasePoint=\"Beginning\"/>"
539
- + "<m:ParentFolderIds>"
540
- + "<t:FolderId Id=\" " + id + "\" />"
541
- + "</m:ParentFolderIds>"
542
- + "</m:FindItem>"
543
- + "</soap:Body>"
544
- + "</soap:Envelope>" ;
545
-
546
- org .w3c .dom .Document xml = conn .execute (msg );
547
- //new javaxt.io.File("/temp/exchange-sort.xml").write(xml);
548
-
549
520
java .util .HashMap <String , javaxt .utils .Date > index = new java .util .HashMap <String , javaxt .utils .Date >();
550
521
551
- org .w3c .dom .Node [] items = javaxt .xml .DOM .getElementsByTagName ("Items" , xml );
552
- if (items .length >0 ){
553
- org .w3c .dom .NodeList nodes = items [0 ].getChildNodes ();
554
- for (int i =0 ; i <nodes .getLength (); i ++){
555
- org .w3c .dom .Node node = nodes .item (i );
556
- if (node .getNodeType ()==1 ){
557
- FolderItem item = new FolderItem (node );
558
- index .put (item .getID (), item .getLastModifiedTime ());
522
+ int offset = 0 ;
523
+ int limit = 1000 ;
524
+
525
+
526
+ while (true ){
527
+
528
+
529
+ String msg =
530
+ "<?xml version=\" 1.0\" encoding=\" utf-8\" ?>"
531
+ + "<soap:Envelope xmlns:soap=\" http://schemas.xmlsoap.org/soap/envelope/\" xmlns:t=\" http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:m=\" http://schemas.microsoft.com/exchange/services/2006/messages\" >"
532
+ + "<soap:Body>"
533
+ + "<m:FindItem Traversal=\" Shallow\" >"
534
+ + "<m:ItemShape>"
535
+ + "<t:BaseShape>IdOnly</t:BaseShape>" //<--"Default" vs "AllProperties"
536
+ + "<t:AdditionalProperties>"
537
+ + "<t:ExtendedFieldURI PropertyTag=\" 0x3008\" PropertyType=\" SystemTime\" />" //<--This returns the LastModifiedTime!
538
+ + "</t:AdditionalProperties>"
539
+ + "</m:ItemShape>"
540
+
541
+ + "<m:SortOrder>"
542
+ + "<t:FieldOrder Order=\" Descending\" >"
543
+ + "<t:ExtendedFieldURI PropertyTag=\" 0x3008\" PropertyType=\" SystemTime\" />"
544
+ + "</t:FieldOrder>"
545
+ + "</m:SortOrder>"
546
+
547
+ //+ "<m:IndexedPageItemView MaxEntriesReturned=\"1\" Offset=\"0\" BasePoint=\"Beginning\"/>"
548
+ + "<m:IndexedPageItemView MaxEntriesReturned=\" " + limit + "\" Offset=\" " + offset + "\" BasePoint=\" Beginning\" />"
549
+
550
+
551
+ + "<m:ParentFolderIds>"
552
+ + "<t:FolderId Id=\" " + id + "\" />"
553
+ + "</m:ParentFolderIds>"
554
+ + "</m:FindItem>"
555
+ + "</soap:Body>"
556
+ + "</soap:Envelope>" ;
557
+
558
+ org .w3c .dom .Document xml = conn .execute (msg );
559
+
560
+ org .w3c .dom .Node [] items = javaxt .xml .DOM .getElementsByTagName ("Items" , xml );
561
+ int numItems = 0 ;
562
+ if (items .length >0 ){
563
+ org .w3c .dom .NodeList nodes = items [0 ].getChildNodes ();
564
+ for (int i =0 ; i <nodes .getLength (); i ++){
565
+ org .w3c .dom .Node node = nodes .item (i );
566
+ if (node .getNodeType ()==1 ){
567
+ FolderItem item = new FolderItem (node );
568
+ index .put (item .getID (), item .getLastModifiedTime ());
569
+ numItems ++;
570
+ }
559
571
}
572
+
560
573
}
561
574
562
- }
575
+ offset +=numItems ;
576
+
577
+ //System.out.println("Found " + numItems + " items");
578
+
579
+ if (numItems ==0 || numItems <limit ) break ;
580
+ }
563
581
564
582
return index ;
565
583
}
@@ -610,7 +628,7 @@ public static String[] getDistinguishedFolderIds(){
610
628
return DistinguishedFolderIds ;
611
629
}
612
630
613
-
631
+
614
632
//**************************************************************************
615
633
//** getDistinguishedFolderId
616
634
//**************************************************************************
@@ -623,7 +641,7 @@ public static String getDistinguishedFolderId(String folderName){
623
641
return null ;
624
642
}
625
643
626
-
644
+
627
645
//**************************************************************************
628
646
//** DistinguishedFolderIds
629
647
//**************************************************************************
0 commit comments