?
Solved

Accessing shared calendar in Outlook 2010  VB.net

Posted on 2012-08-20
3
Medium Priority
?
1,998 Views
Last Modified: 2012-10-16
Hello,

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.

Thanks
0
Comment
Question by:Petermcg001
  • 2
3 Comments
 
LVL 9

Expert Comment

by:teebon
ID: 38319947
Can you post your conversion code and also the exception that you are getting?
0
 
LVL 1

Author Comment

by:Petermcg001
ID: 38320316
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 = _
       oNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)


        Dim oMeeting As Outlook.AppointmentItem


        For Each oMeeting In oOutlookFolder.Items
            MsgBox(oMeeting.Subject)

        Next

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.

Thanks
0
 
LVL 9

Accepted Solution

by:
teebon earned 2000 total points
ID: 38335732
Hi Peter,

Try utilizing the GetPublicFolder function to access your shared calendar:
http://www.outlookcode.com/codedetail.aspx?id=1164

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
        Next
    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

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
I came across an unsolved Outlook issue and here is my solution.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

578 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