从Outlook获取收件箱 [英] Get Inboxes from Outlook

查看:109
本文介绍了从Outlook获取收件箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Outlook 2010中配置了两个Exchange帐户,但是我找不到如何访问第二个帐户的收件箱. Session.GetDefaultFolder() 始终返回第一个.

I configured two Exchange accounts in Outlook 2010, however I cant find out how to get to Inbox of the second account. Session.GetDefaultFolder() always return the first one.

即使枚举Session.Accounts,找到正确的帐户并调用 Session.Account(found one).Store.GetDefaultFolder() ,也会返回错误的收件箱(来自默认的交换帐户,而不是辅助帐户).

Even enumerating Session.Accounts, finding the right account and calling Session.Account(found one).Store.GetDefaultFolder() returns wrong Inbox (from the default exchange account, not the secondary).

推荐答案

这是否显示了所有可用的收件箱?

Does this show you all the available Inboxes?

Sub LoopThroughInboxes

Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim i As Long

Set ol = Outlook.Application
Set ns = ol.GetNamespace("MAPI")

For i = 1 To ns.Folders.Count
 Debug.Print ns.Folders(i).Name
Next i

如果是,则ns.Folders(i).Folders("Inbox")将为您获取每个邮箱的收件箱.

If so then ns.Folders(i).Folders("Inbox") will get you the Inbox for each mailbox.

这篇关于从Outlook获取收件箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆