Is it possible to know the EntryID of a Public Folders for contacts in Exchange without using the PickFolder method?
Printable View
Is it possible to know the EntryID of a Public Folders for contacts in Exchange without using the PickFolder method?
You can navigate down the folder structure to your destination public folder. Then get its .EntryID value.
This value does not ever change unless the folder is deleted and recreated.
Is the destination folder dynamic or will it be in the same location all the time?
Just in case, here is a demo to transversing the Public folders to a folder called "Development".
VB Code:
Option Explicit 'Add a reference to MS Outlook xx.0 Object Library Private Sub Command1_Click() Dim oApp As Outlook.Application Dim oNS As Outlook.NameSpace Dim oPublicFolders As Outlook.MAPIFolder Dim oAllPublicFolders As Outlook.MAPIFolder Dim oFolder As Outlook.MAPIFolder Dim sEntryID As String Set oApp = New Outlook.Application Set oNS = oApp.GetNamespace("MAPI") Set oPublicFolders = oNS.Folders("Public Folders") Set oAllPublicFolders = oPublicFolders.Folders("All Public Folders") Set oFolder = oAllPublicFolders.Folders("Development") sEntryID = oFolder.EntryID Debug.Print sEntryID Set oFolder = Nothing Set oAllPublicFolders = Nothing Set oPublicFolders = Nothing Set oNS = Nothing Set oApp = Nothing End Sub
Is it normal that this code is working on Outlook 2002 with Windows XP and not on Outlook 2002 with Windows 2000?
What error are you getting?
The operation failed. An object could not be found.
The error occurs on this line :
VB Code:
Set oPublicFolders = oNS.Folders("Public Folders")