none
Add a Sharepoint Calendar to a specific Calendar Group with VBA in Outlook RRS feed

  • Question

  • Hi,

    I want to add a sharepoint calendar to a specific existing - or to one I've created - calendar group in Outlook with VBA:

    Sub NewOutlookCalendarGroup()
        Dim objOutlook As Outlook.Application
        Dim objNavigationPane As Outlook.NavigationPane
        Dim objCalendarModule As Outlook.CalendarModule
        Dim objCalendarGroups As Outlook.NavigationGroups
        Dim objCalendarGroup As Outlook.NavigationGroup
        Dim objCalendarFolders As Outlook.NavigationFolders
        Dim url As String
    
        Set objNavigationPane = Application.ActiveExplorer.NavigationPane
        Set objCalendarModule = objNavigationPane.Modules.GetNavigationModule(olModuleCalendar)
        Set objCalendarGroups = objCalendarModule.NavigationGroups
        objCalendarGroups.Create ("Bereitschaft")
        
        Set objOutlook = CreateObject("Outlook.Application")
        url = "stssync://sts/?ver=1.1&type=calendar&cmd=add-folder&base-url=https[...]Bereitschaft"
        objOutlook.Session.OpenSharedFolder (url)
    End Sub

    However, the calendar group "Other calendars" is always created automatically. How can I make my calendar group "Bereitschaft" the default (parent) calendar group so that the Sharepoint calendar is integrated there?


    Thank you very much.


    Thursday, October 24, 2019 1:08 PM