Accessing shared calendar in Outlook 2010

Posted on 2012-08-20
Last Modified: 2012-10-16

I need help adding an appointment to a shared Calendar in Outlook 2010.

I did this in Outlook 2007 but cannot convert the routine to 2010.

Question by:Petermcg001
    LVL 9

    Expert Comment

    Can you post your conversion code and also the exception that you are getting?
    LVL 1

    Author Comment

    Thanks for looking at this.

    This is the code that calls the default calendar:-

      Dim oOutlook As Outlook.Application = New Outlook.Application
            Dim oNamespace As Outlook.NameSpace = oOutlook.GetNamespace("MAPI")

            Dim oOutlookFolder As Outlook.Folder = _

            Dim oMeeting As Outlook.AppointmentItem

            For Each oMeeting In oOutlookFolder.Items


    But this looks at my "normal" calendar.  I need to be able to access a calendar that appears within the "Other Calendars" section of Outlook.

    LVL 9

    Accepted Solution

    Hi Peter,

    Try utilizing the GetPublicFolder function to access your shared calendar:

    Public Function GetPublicFolder(strFolderPath)
        Dim colFolders
        Dim objFolder
        Dim arrFolders
        Dim i
        On Error Resume Next
        strFolderPath = Replace(strFolderPath, "/", "\")
        arrFolders = Split(strFolderPath, "\")
        Set objFolder = Application.Session.GetDefaultFolder(18)
        Set objFolder = objFolder.Folders.Item(arrFolders(0))
        If Not objFolder Is Nothing Then
            For i = 1 To UBound(arrFolders)
                Set colFolders = objFolder.Folders
                Set objFolder = Nothing
                Set objFolder = colFolders.Item(arrFolders(i))
                If objFolder Is Nothing Then
                    Exit For
                End If
        End If
        Set GetPublicFolder = objFolder
        Set colFolders = Nothing
         Set objApp = Nothing
        Set objFolder = Nothing
    End Function

    Open in new window

    Call the function :

    strPublicFolder = "Other Calendars\Calendar1"
    Set fldFolder = GetPublicFolder(strPublicFolder)

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Learn more about the importance of email disclaimers with our top 10 email disclaimer DOs and DON’Ts.
    Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now