Outlook Can';不要读我的;“在线存档”;来自EWS的邮件?

Outlook Can';不要读我的;“在线存档”;来自EWS的邮件?,outlook,exchange-server,office365,exchangewebservices,office365api,Outlook,Exchange Server,Office365,Exchangewebservices,Office365api,我们使用Office 365 当我尝试在共享的在线存档邮箱中获取邮件时,它不会返回任何结果 这是我的密码: Private Sub DownloadEmailFromProperties(userLogin As String, userPassword As String, sharedMailbox As String) Dim service As New ExchangeService(ExchangeVersion.Exchange2013) service.Crede

我们使用Office 365

当我尝试在共享的在线存档邮箱中获取邮件时,它不会返回任何结果

这是我的密码:

Private Sub DownloadEmailFromProperties(userLogin As String, userPassword As String, sharedMailbox As String)
    Dim service As New ExchangeService(ExchangeVersion.Exchange2013)
    service.Credentials = New WebCredentials(userLogin, userPassword)
    service.Url = New System.Uri("https://outlook.office365.com/EWS/Exchange.asmx")

    Dim mb As Mailbox = New Mailbox(sharedMailbox)
    Dim view As ItemView = New ItemView(50, 0, OffsetBasePoint.Beginning)
    view.PropertySet = PropertySet.IdOnly

    Dim results As FindItemsResults(Of Item) = service.FindItems(New FolderId(WellKnownFolderName.ArchiveMsgFolderRoot, mb), view)

    MsgBox(results.Count) ' results.count is 0 :(    
End Sub

关于如何通过EWS访问在线存档邮件,有什么建议吗?

您似乎只访问存档存储的根目录,那里通常不会有任何内容。您应该对归档存储中的文件夹执行FindFolder操作(从MsgRoot开始),然后检查文件夹中的项目数(而不是使用findItems)。您可以使用EWS编辑器轻松地测试这一点,而无需编写任何代码

您还应该在FindItemsResults类上使用TotalCount属性

干杯 峡谷