Exchange 2010和根文件夹

时间:2012-05-08 05:08:20

标签: vb6 exchange-server mapi exchange-server-2010 exchange-server-2003

在Exchange 2003上,我可以运行以下代码。

使用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年是否不支持此属性?

欢迎任何建议, 感谢。

2 个答案:

答案 0 :(得分:1)

您确定您的Exchange 2010实际上有PF商店吗? 尝试在循环存储之前首先访问默认存储(例如,读取收件箱文件夹名称) - 这将导致CDO 1.21命中服务器并意识到没有PF存储。

答案 1 :(得分:0)

@Dmitry Streblechenko是对的,我刚刚添加了PF,它起作用了。

New-PublicFolderDatabase "Public Folders" -Server $MyServer
Mount-Database "Public Folders"