Getting Private Appointments from the calendar

  • Thread starter Thread starter Matthew Gonzalez
  • Start date Start date
M

Matthew Gonzalez

Hello everyone, I am currently using the following code to get a list of
appointments for the day for several users (myUserList) and it works
great except it ignores Private Appointments. I don't need any details
on the appointment but I would like it to at least block out that time
so we don't think the time is free. Here is the piece of code:

' Get users appointments from Calendar folder.
Set myNS = myOlApp.GetNamespace("MAPI")
Set CalendarFolder = myNS.GetSharedDefaultFolder(myUserList(I),
olFolderCalendar)
Set myAppts = CalendarFolder.Items


I then sort, include recurrences, sort again, then feed each appointment
into a text string which gets pasted into a new Word document. So what
do I need to add/change to get it to include private appointments?

Thanks!



Matthew Gonzalez
 
Matthew Gonzalez said:
I don't need any details
on the appointment but I would like it to at least block out that time
so we don't think the time is free.

Not sure about the private appointments problem, but just to know when
they're not available, AddressEntry.GetFreeBusy() is probably what you
want.

-- dan
 
Dan said:
Not sure about the private appointments problem, but just to know when
they're not available, AddressEntry.GetFreeBusy() is probably what you
want.

Thanks dan, I'm actually putting in the start and end times, and the
subject line of the appointment as well. From my quick read of the help
file GetFreeBusy won't do that. For the private appointments I would
just like it to read similarly, something like:

8:00 AM-8:30 AM Schedule Meeting
9:00 AM-9:30 AM Another Meeting
11:30 AM-1:00 PM Appointment Here
1:00 PM-2:00 PM Private Appointment

As it stands right now, that last line simply doesn't show up.




Matthew Gonzalez
 
Matthew Gonzalez said:
Thanks dan, I'm actually putting in the start and end times, and the
subject line of the appointment as well. From my quick read of the help
file GetFreeBusy won't do that.

No, you'd have to read the freebusy data, and turn that into a list of
when they are and aren't busy -- it'll be a string of characters
representing their status over the period you ask for, and you'll need
to loop over that period and turn the busy sections into appointments;
something like (typed off the top of my head, it'll need converting into
whichever language you're using, and may well be completely wrong, but
hopefully you get the idea)

bool binbusy
int ibusystart
for i = 0 to length(freebusystring)
if (freebusystring == '1' && !bInBusy)
// start of busy time
bInBusy = true
ibusystart = i;

if (freebusystring == '0' && bInBusy)
// end of busy time
bInBusy = false
DATE dtStart = dtStartOfQuery + ibusystart*interval
DATE dtEnd = dtStartOfQuery + i * interval
AddPrivateAppointment(dtStart, dtEnd)

next
// bug: what if they started off busy or end busy? deal with this.

-- dan
 
Dan said:
No, you'd have to read the freebusy data, and turn that into a list of
when they are and aren't busy
(snip)

That sounds like it might work though it seems like a lot more work than
what I am currently doing. I could then check the free/busy times
against their calendar again to get the subject lines as well, just
manually filling in "Private Appointment" for those times that don't
seem to have a match. I'm going to keep looking for a more efficient
way (which doesn't require a complete rewrite of what I have) but I'll
keep this in mind. Thanks.




Matthew Gonzalez
 
Back
Top