PC Review

Thread Tools Rate Thread

Script for showing Public Folder Calender to Main Mail Favorite f

New Member
Join Date: Oct 2011
Posts: 1
      29th Oct 2011

Can we automate the process of showing public folder calender to mail favorite folder.

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 a login 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 am new for VB script but tried to modified it for achieving my target but no luck!!

this is my public folder

wanted to show here

Reply With Quote

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Public Folder Calendar Object to mail plane favorite folder Kim Mortensen Microsoft Outlook Discussion 1 30th Nov 2009 12:46 PM
Public folder calender "overlay" onto personal calender Richard Edwards Microsoft Outlook 2 10th Apr 2006 02:13 PM
microsoft.public.developer.outlook.addins, microsoft.public.outlook.program_addins,microsoft.public.dotnet.languages.csharp,microsoft.public.outlook.general Anushya Microsoft C# .NET 0 15th Jan 2004 07:18 AM
microsoft.public.developer.outlook.addins,microsoft.public.dotnet.languages.csharp,microsoft.public.outlook.program_addins,microsoft.public.outlook.general Anushya Microsoft Dot NET Framework Forms 0 9th Jan 2004 08:21 AM
microsoft.public.dotnet.languages.vb.data,microsoft.public.dotnet.languages.vb.controls,microsoft.public .dotnet.languages.vb,microsoft.public.dotnet.languages.vb.upgrade Gladys Microsoft VB .NET 3 2nd Jan 2004 07:14 PM




All times are GMT +1. The time now is 06:46 PM.