即,另一帳戶的收件箱。
假設你在談論的共享收件箱
VBA示例代碼將
Option Explicit
Sub OpenShareInbox()
Dim olNameSpace As Outlook.NameSpace
Dim olRec As Outlook.Recipient
Dim olFolder As Outlook.Folder
Set olNameSpace = Application.GetNamespace("MAPI")
Set olRec = olNameSpace.CreateRecipient("[email protected]") '// Owner's email address
Set olFolder = olNameSpace.GetSharedDefaultFolder(olRec, olFolderInbox)
MsgBox olRec.Name '// Owner Name
olFolder.Display '// Open Inbox
End Sub
編輯:
下面是另一個例子 - 打開即時窗口和打印主題行
Option Explicit
Sub OpenShareInbox()
Dim olNameSpace As Outlook.NameSpace
Dim olRec As Outlook.Recipient
Dim olFolder As Outlook.Folder
Dim olItem As Outlook.MailItem
Set olNameSpace = Application.GetNamespace("MAPI")
Set olRec = olNameSpace.CreateRecipient("[email protected]") '// Owner's email address
Set olFolder = olNameSpace.GetSharedDefaultFolder(olRec, olFolderInbox) '// Inbox
For Each olItem In olFolder.Items
Debug.Print olItem.Subject
Next
End Sub
與主題行「報告」
For Each olItem In olFolder.Items
If olFolder.DefaultItemType = olMailItem Then
If olItem.Class = olMail Then
If olItem.Subject = "Report" Then
Set olItem = olItem.Forward
olItem.Subject = "APPENDED SUBJECT - " + olItem.Subject + ""
olItem.Recipients.Add "Om3r <[email protected]>"
olItem.Display
' olItem.Send
End If
End If
End If
Next
或轉發郵件項目見NameSpace.GetSharedDefaultFolder
Method (Outlook)on MSDN
此代碼聲明瞭一堆的變數,但*無助* .... –
[獲取參考的可能的複製到額外的收件箱](http://stackoverflow.com/questions/9076634/get-reference-to-additional-inbox) – niton
變化的解釋和方法。 http://stackoverflow.com/questions/28310088/using-microsoft-access-need-to-pull-attachments-from-outlook-emails-of-a-differ和http://stackoverflow.com/questions/26274516/ vba-get-email-from-non-default-inbox – niton