Collection appts = mbox.getAppointmentsForRange(null, start, end, Mailbox.ID_AUTO_INCREMENT);
List  folders = mbox.getItemList(null, MailItem.TYPE_FOLDER); ArrayList  excludeFolders = new ArrayList(); for (Iterator iter = folders.iterator(); iter.hasNext();) { Folder f = (Folder)iter.next(); if ((f.getFlagBitmask() & Flag.ID_FLAG_EXCLUDE_FREEBUSY)!= 0) excludeFolders.add(f); }  int[] exFolders = null; if (excludeFolders.size() > 0) { exFolders = new int[excludeFolders.size()]; int i = 0; for (Iterator iter = excludeFolders.iterator(); iter.hasNext(); i++) { Folder f = (Folder)iter.next(); exFolders[i] = f.getId(); } }  Collection appts = mbox.getAppointmentsForRange(null, start, end, Mailbox.ID_AUTO_INCREMENT, exFolders);
    public static FreeBusy getFreeBusyList(Mailbox mbox, long start, long end) throws ServiceException {        Collection appts = mbox.getAppointmentsForRange(null, start, end, Mailbox.ID_AUTO_INCREMENT);        IntervalList intervals = new IntervalList(start, end);                for (Iterator iter = appts.iterator(); iter.hasNext(); ) {            Appointment cur = (Appointment)iter.next();                        Collection instances = cur.expandInstances(start, end);             for (Iterator instIter = instances.iterator(); instIter.hasNext();) {                Appointment.Instance inst = (Appointment.Instance)(instIter.next());                assert(inst.getStart() < end && inst.getEnd() > start);                InviteInfo invId = inst.getInviteInfo();                try {                    Appointment appt = mbox.getAppointmentById(null, inst.getAppointmentId());                    Invite inv = appt.getInvite(invId);                    if (!inv.isTransparent()) {                        String freeBusy = inv.getFreeBusyActual();                        Interval ival = new Interval(inst.getStart(), inst.getEnd(), freeBusy);                        intervals.addInterval(ival);                    }                } catch (MailServiceException.NoSuchItemException e) {                    sLog.debug("Could not load invite "+invId.toString() + " for appt "+mbox.getId());                }            }        }        return new FreeBusy(intervals);    }