Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA, Outlook, Seeing 'People's Calendars

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'?

like image 926
ForEachLoop Avatar asked Dec 09 '25 23:12

ForEachLoop


1 Answers

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
like image 132
Alain Avatar answered Dec 11 '25 22:12

Alain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!