'Outlook VSTO - Get all items in a group calendar

I am looking for a way to access a group calendar in Outlook VSTO Add-In. I am only able to search the default calendar in outlook. I have shared an image from outlook below that shows several group calendars. How can I access those group calendars from VSTO code?

Outlook group calendar navigation pane



Solution 1:[1]

You can use the NavigtionModule object in Outlook to get access to group calendars (or shared ones). The NavigationModule object provides access to the various navigation modules that are displayed in the Microsoft Outlook Navigation Pane. For example:

Sub Test()

Const olFolderCalendar = 9
Const olModuleCalendar = 1
Const olAppointmentItem = 1
Dim answer As Integer
Dim objNS
Dim objExpCal
Dim objNavMod
Dim objNavGroup
Dim objNavFolder
Dim objFolder
Dim colExpl

Set oApp = CreateObject("Outlook.Application")
Set objNS = oApp.Session
Set colExpl = oApp.Explorers
Set objExpCal = objNS.GetDefaultFolder(olFolderCalendar).GetExplorer
Set objNavMod = objExpCal.NavigationPane.Modules.GetNavigationModule(olModuleCalendar)

For Each objNavGroup In objNavMod.NavigationGroups
    For Each objNavFolder In objNavGroup.NavigationFolders
        If Not objNavFolder = "YOUR CALENDAR NAME" Then 'exactly as in Outlook
            GoTo NxtGroup
        End If
        On Error Resume Next
        Set objFolder = objNavFolder.Folder

NxtGroup:
    Next
Next

MsgBox objFolder.Name

Set objNS = Nothing
Set objNavMod = Nothing
Set objNavGroup = Nothing
Set objNavFolder = Nothing
Set objFolder = Nothing
Set colExpl = Nothing

End Sub

Solution 2:[2]

Adding the C# version of the answer since the original question was requested for C#

        Outlook.NameSpace mapiNamespace = Globals.ThisAddIn.Application.GetNamespace("MAPI");
        Outlook.CalendarModule calendarModule = (Outlook.CalendarModule)mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).GetExplorer().NavigationPane.Modules.GetNavigationModule(Outlook.OlNavigationModuleType.olModuleCalendar);
        Outlook.NavigationGroups navGroups = calendarModule.NavigationGroups;
        foreach (Outlook.NavigationGroup navGroup in navGroups)
        {
            Outlook.NavigationFolders navFolders = navGroup.NavigationFolders;
            foreach (Outlook.NavigationFolder navFolder in navGroup.NavigationFolders)
            {
                try
                {
                    if (navFolder.Folder != null && navFolder.Folder.Name.Equals("<Add your group calendar name here>"))
                    {
                       //do stuff here
                        return;
                    }
                }
                catch (Exception ex)
                {
                   //handle exception as needed and iterate to next 
                   continue;
                }
                    
            }
        }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Astafiev
Solution 2 Ashish Dhandharia