When you get the default Inbox folder it's always in your default mailbox or
PST file. It can never be in a non-default store or a public folder.
Unfortunately the only language-independent method of seeing if a folder is
in a public folder store uses CDO 1.21 (optional installation with Outlook
2000 and later). It can also be done with Extended MAPI (C++ or Delphi code
only) or the forthcoming version of Redemption (
www.dimastr.com) using the
new RDOSession object.
CDO 1.21 code would look something like this:
Public Function IsPublicFoldersStore(strStoreID As String) As Boolean
Dim g_objCDO As MAPI.Session
Dim objRootFolder As MAPI.Folder
Dim objField As MAPI.Field
Dim objStore As MAPI.InfoStore
On Error Resume Next
Set g_objCDO = CreateObject("MAPI.Session")
g_objCDO.Logon "", "", False, False
Set objStore = g_objCDO.GetInfoStore(strStoreID)
With objStore
If .ProviderName = "Microsoft Exchange Server" Then
Set objRootFolder = .RootFolder
If objRootFolder.Name = "IPM_SUBTREE" Then
Err.Clear
Set objField = .Fields.Item(PR_IPM_PUBLIC_FOLDERS_ENTRYID)
If Err Then
IsPublicFoldersStore = False
Else
If objField <> "" Then
IsPublicFoldersStore = True
Else
IsPublicFoldersStore = False
End If
End If
Else
IsPublicFoldersStore = False
End If
Else
IsPublicFoldersStore = False
End If
End With
Set objRootFolder = Nothing
Set objField = Nothing
Set objStore = Nothing
End Function