• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 839
  • Last Modified:

How to automate Public folder calender to show in Favorite Folder of mail.


How to automate the process to show my public folder calender in Mail Favorite folder?

I wanted to do it either by login script or by group policy.

I am using Microsoft Exchange server 2007 with Windows Server 2008 R2 and Domain controller running Windows Server 2003 R2.  

All workstation system have either Outlook 2010 or Outlook 2007.

While searching on this I found the script below, but by this script (already modified the path) I am just able to make public folder calender to show in public folder favorite but not in mail favorite folder.

 Const olPublicFoldersAllPublicFolders = 18
Dim olkApp, olkSes, olkFolder
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNameSpace("MAPI")
'Change the profile name on the next line'
olkSes.Logon "Outlook"
'Change the folder name on the next line.  Repeat the next two lines for each folder you want to add.'
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Public calender").Folders("p cal")
'Change the folder name on the next line.  Repeat the next two lines for each folder you want to add.'
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\P cal")
AddFavoriteFolder olkFolder
Set olkApp = Nothing
Set olkSes = Nothing
Set olkFolder = Nothing
Sub AddFavoriteFolder(olkFolder)
    ' Purpose: Add a folder to Favorite Folders.'
    ' Written: 5/2/2009'
    ' Author:  BlueDevilFan'
    ' Outlook: 2007'
    Const olModuleMail = 0
    Const olFavoriteFoldersGroup = 4
        Dim olkPane, olkModule, olkGroup
    Set olkPane = olkApp.ActiveExplorer.NavigationPane
    Set olkModule = olkPane.Modules.GetNavigationModule(olModuleMail)
    Set olkGroup = olkModule.NavigationGroups.GetDefaultNavigationGroup(olFavoriteFoldersGroup)
    olkGroup.NavigationFolders.Add olkFolder
    Set olkPane = Nothing
    Set olkModule = Nothing
    Set olkGroup = Nothing
End Sub
Function OpenOutlookFolder(strFolderPath)
    ' Purpose: Opens an Outlook folder from a folder path.'
    ' Written: 4/24/2009'
    ' Author:  BlueDevilFan'
    ' Outlook: All versions'
    Dim arrFolders, varFolder, bolBeyondRoot
    On Error Resume Next
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
        Do While Left(strFolderPath, 1) = "\"
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            Select Case bolBeyondRoot
                Case False
                    Set OpenOutlookFolder = olkSes.Folders(varFolder)
                    bolBeyondRoot = True
                Case True
                    Set OpenOutlookFolder = OpenOutlookFolder.Folders(varFolder)
            End Select
            If Err.Number <> 0 Then
                Set OpenOutlookFolder = Nothing
                Exit For
            End If
    End If
    On Error GoTo 0
End Function

I wanted my this folder
     Public Calender
TO show here
 I want "P cal" here
  • 3
  • 2
1 Solution
OTSSolutionsAuthor Commented:
Thanks for Reply

Sorry but that past was done by me for the same issue.
OTSSolutionsAuthor Commented:
I am still facing the same issue.  I think I am missing a little somewhere in the VB script. Any one know VB script of outlook please help me in making this script working.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

David LeeCommented:
Hi, OTSSolutions.

This isn't possible either via a macro or manually.  You can't have a calendar appear in Favorites.  Favorites is strictly for mail folders.  The option to add a folder to Favorites is only available if the folder you've right-clicked on is a mail folder.
OTSSolutionsAuthor Commented:
Hi BlueDevilFan,

Thanks alot for you reply.  can I use the same script to show Public calendar to Public Favorite folder as a login script.
David LeeCommented:
You're welcome.  

Yes, the script can be integrated into a login script.

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now