0

在Exchange 2003上,我可以運行以下代碼。Exchange 2010和根文件夾

使用VB6和MAPI CDO 1.2.1

Private Sub Command1_Click() 
    Dim objSession As MAPI.Session 
    Set objSession = CreateObject("MAPI.Session") 
    strProfileInfo = myExcServer & vbLf & myExcAlias 
    objSession.Logon ProfileInfo:=strProfileInfo 
    For Each nfo In objSession.InfoStores 
     Text1.Text = Text1.Text & "nfo.Name: " & nfo.Name & vbNewLine 
     Text1.Text = Text1.Text & "nfo.RootFolder.Name: " & nfo.RootFolder.Name & vbNewLine 
    Next 
    Set objMessage = Nothing 
    Set objInbox = Nothing 
    objSession.Logoff 
    Set objSession = Nothing 
End Sub 

我得到:

nfo.Name: Public Folders 
nfo.RootFolder.Name: IPM_SUBTREE 
nfo.Name: Mailbox - pperez pperez 
nfo.RootFolder.Name: Top of Information Store 

但是我試圖在Exchange 2010上運行它,但我發現了一個錯誤,

nfo.Name: Public Folders 
Run-time error '-2147221219 (8004011D)': 
[Collaboration Data Objects - [MAPI_E_FAILONEPROVIDER(8004011D)]] 

僅在對根文件夾nfo.RootFolder.Name的引用中引發了異常。

該屬性在2010年不支持?

歡迎任何意見, 謝謝。

回答

1

您確定您的Exchange 2010實際上擁有PF商店嗎? 嘗試在循環訪問商店之前首先訪問默認商店(例如,讀取收件箱文件夾名稱) - 這將導致CDO 1.21擊中服務器並意識到沒有PF商店。

0

@Dmitry Streblechenko是對的,我只是增加了PFs,它的工作。

New-PublicFolderDatabase "Public Folders" -Server $MyServer 
Mount-Database "Public Folders" 
相關問題