使用Namespace.GetSharedDefaultFolder
。即使郵箱未在當前配置文件中打開,它也可以工作。你還需要有打開郵箱的權利,並在過程中的問題訪問該文件夾:
Set vNamespace = Application.GetNamespace("MAPI")
set vRecipient = vNamespace.CreateRecipient("Procurement, Request")
if vRecipient.Resolve Then
set vFolder = vNamespace.GetSharedDefaultFolder(vRecipient, olFolderInbox)
End If
如果需要打開其他用戶的郵箱(其全部關閉文件夾),你可以使用Redemption及其RDOSession .GetSharedMailbox方法:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.GetSharedMailbox("Procurement, Request")
set vFolder = Store.GetDefaultFolder(olFolderInbox)
MsgBox "The address of the mailbox owner: " & Store.Owner.Address
非常感謝您! :) – Mark 2012-01-31 09:51:23
@MarkTait很高興能有所幫助:) – brettdj 2012-01-31 09:59:41
只有當商店已被添加到curent配置文件時,此功能纔有效。 – 2017-10-12 16:09:52