outlook - Reading calendar folder in a date range using JACOB -
hi guys possible on jacob on reading calendar folder date range , let me subject. if yes please give sample code reference. lot
this code has 2 filters
1) first date range - start , end date
2) filter subject = "test"
if need date, can omit second filter.
how to: filter recurring appointments , search string in subject
dispatch namespace = outlokax.getproperty("session").todispatch(); dispatch calendarfolder = dispatch.call(namespace, "getdefaultfolder", new integer(9)).todispatch(); dispatch calitems = dispatch.get(calendarfolder, "items").todispatch(); string customfilter = "@sql=\"urn:schemas:calendar:dtstart\" > '" + dateutility.datetoutcstring(startdate) + "' , \"urn:schemas:calendar:dtend\" = '" + dateutility.datetoutcstring(enddate) + "'" ; string customfindfilter = "@sql=\"urn:schemas:httpmail:subject\" '" + "test" + "'" ; dispatch restricteditems = dispatch.call(calitems, "restrict", new variant(customfilter)).todispatch(); //works dates dispatch.call(calitems, "sort", "[start]"); dispatch.put(restricteditems, "includerecurrences", "false"); int numberofmatchingitems = 0; dispatch lastitemfound = null; if (restricteditems != null && restricteditems.m_pdispatch > 0) { dispatch finditem = dispatch.call(restricteditems, "find", customfindfilter).todispatch(); // find works other attributes while (finditem != null && finditem.m_pdispatch > 0) { numberofmatchingitems++; lastitemfound = finditem; finditem = dispatch.call(restricteditems, "findnext").todispatch(); variant start = dispatch.get(finditem, "start"); variant end = dispatch.get(finditem, "end"); variant subject = dispatch.get(finditem, "subject"); system.out.println("# outlook event fetched: " + subject + " start: '" + start + "' end '" + end + "'"); } }