VBA, Outlook, Seeing 'People's Calendars

12,496

Check out the returned values from the following code. It searches for a person by name, same way as when you are typing a recipient into a new email, and then grabs that persons shared calendar and enumerates all shared appointments.

Dim _namespace As Outlook.NameSpace
Dim _recipient As Outlook.Recipient
Dim calendarFolder As Outlook.Folder

Set _namespace = Application.GetNamespace("MAPI")
Set _recipient = _namespace.CreateRecipient(name)
_recipient.Resolve

If _recipient.Resolved Then
    Set calendarFolder = _namespace.GetSharedDefaultFolder(_recipient, olFolderCalendar)
    'This would display the calendar on the screen:
    'calendarFolder.Display

    Dim oItems As Outlook.Items
    Set oItems = calendarFolder.Items
    'oItems is now a set of all appointments in that person's calendar
    'Play on
End if
Share:
12,496
ForEachLoop
Author by

ForEachLoop

I'm a programmer, writer, and programmer-writer with the NASA Johnson Space Center in Houston. I write efficiency tools, focusing on Microsoft Office documents, most notably Word documents. I once wrote a product tracking application, in part making sure astronauts have clean underwear. Mundane perhaps, but the astronauts appreciate it. I have documented APIs for a long time, first at Microsoft, and then at NASA. In my so-called spare time I write about programming, APIs, and Microsoft Word automation. I've authored three books. I have a API documentation book coming out in spring of 2018 and before that was "The Secret Life of Word." Both from XML Press (xmlpress.net), available at Amazon.com and 10,000 other online bookstores. My first book as "Introduction to Microsoft Kokanee" (2002, Microsoft Press), about Microsft's speech recognition software.

Updated on June 04, 2022

Comments

  • ForEachLoop
    ForEachLoop almost 2 years

    I am tring to programmatically (with VBA) to access calendars others share with me. They are listed in my Outlook under 'People's Calendars.' I have searched the Web for this and all the suggestions have done little more than confuse me. How can I get a listing of all the calendars shared to me, and then one calendar in specific, from among the 'People's Calendars'?