views:

129

answers:

0

I've written some VBA which generates an HTML based in/out calendar for all the members of my team. Because I need to get the status of people for the whole year and details of their appointments I've avoided using the FreeBusy information and instead opted to open each users calendar, extract all the appointments and work out which days people are in or out (and colour them appropriately).

To do this I've defined an array that is (9 to 5, 1 to 31, 1 to 12) [essentially work hour, date, month], I read each calendar entry and block out the hours within that based on whether or not the appointment has OlBusyStatus set to olOutOfOffice. So for example, if the appointment is on February 1st from 7am to 3pm then (9 to 3, 1, 2) would all be set to True. I don't bother with before 9 or after 5 as no-one cares then.

This not particularly elegant method (I'm sure) means that when I get around to generating the calendar, I look at each day, count the number of hour blocks which are marked as out of the office and then if it's over 50% of them, mark the whole day as free.

It is actually pretty simple, works well and the result is really pretty (and useful). However I have a problem... reoccurring appointments.

My current solution doesn't support them at all. In order for me to do this, it looks like I'm going to have to check if IsRecurring property is True, then use GetRecurrencePattern to work out what type of pattern and then create code to block out the appropriate hours for each of the 14 (fourteen!!) possible types of recurrence that there could be. Even after I've done all that, I've not taken into account that one of the meetings in the pattern may have been cancelled (or moved).

This looks like a horrific amount of work for something which isn't my day job, I'm doing on the side to help out the team and really don't want to spend too long on.

I've thought about going back to using FreeBusy and getting people to modify their Outlook settings to publish 12 months worth of information, but getting people to do it will be hard enough and I won't be able to get the name of the appointments (which are also put into the in/out calendar and people love them).

So my question is: Is there any way I can work out what appointments someone has on a specific day without having to do what I am now (that is parse the entire list of AppointmentItems that they have)? Is there something which will take into account reoccurring appointments, including those ones which have been cancelled or moved as a one off to other days?

Alternativily, is there a way that given a specific hour, minute and date I can find out someones OlBusyStatus?