use of com.zimbra.client.ZMailbox.ZApptSummaryResult in project zm-mailbox by Zimbra.
the class ZMailboxUtil method doGetAppointmentSummaries.
/*
<CreateAppointmentRequest xmlns="urn:zimbraMail">
<m d="1173202005230" l="10">
<inv>
<comp status="CONF" fb="B" transp="O" allDay="0" name="test yearly">
<s tz="(GMT-08.00) Pacific Time (US & Canada)" d="20070308T130000"/>
<e tz="(GMT-08.00) Pacific Time (US & Canada)" d="20070308T150000"/>
<or a="user1@slapshot.liquidsys.com"/>
<recur>
<add>
<rule freq="YEA">
<interval ival="1"/>
</rule>
</add>
</recur>
</comp></inv><su>test yearly</su><mp ct="multipart/alternative"><mp ct="text/plain"><content></content></mp><mp ct="text/html"><content><html><body></body></html></content></mp></mp></m></CreateAppointmentRequest>
*/
/*
private void testCreateAppt() throws ServiceException {
ZMailbox.ZOutgoingMessage message = new ZOutgoingMessage();
message.setSubject("test zclient API");
message.setMessagePart(new MessagePart("text/plain", "this is da body"));
ZInvite invite = new ZInvite();
ZComponent comp = new ZComponent();
comp.setStart(new ZDateTime("20070309T170000", mMbox.getPrefs().getTimeZoneWindowsId()));
comp.setEnd(new ZDateTime("20070309T210000", mMbox.getPrefs().getTimeZoneWindowsId()));
comp.setOrganizer(new ZOrganizer(mMbox.getName()));
comp.setName("test zclient API");
comp.setLocation("Zimbra");
invite.getComponents().add(comp);
ZAppointmentResult response = mMbox.createAppointment(ZFolder.ID_CALENDAR, null, message, invite, null);
stdout.printf("calItemId(%s) inviteId(%s)%n", response.getCalItemId(), response.getInviteId());
}
*/
private void doGetAppointmentSummaries(String[] args) throws ServiceException {
long startTime = DateUtil.parseDateSpecifier(args[0], new Date().getTime());
long endTime = DateUtil.parseDateSpecifier(args[1], (new Date().getTime()) + Constants.MILLIS_PER_WEEK);
String folderId = args.length == 3 ? lookupFolderId(args[2]) : null;
List<ZApptSummaryResult> results = mMbox.getApptSummaries(null, startTime, endTime, new String[] { folderId }, TimeZone.getDefault(), ZSearchParams.TYPE_APPOINTMENT);
if (results.size() != 1)
return;
ZApptSummaryResult result = results.get(0);
stdout.print("[");
boolean first = true;
for (ZAppointmentHit appt : result.getAppointments()) {
if (!first)
stdout.println(",");
stdout.print(ZJSONObject.toString(appt));
if (first)
first = false;
}
stdout.println("]");
}
Aggregations