这是这个主要问题的一个子问题
我可以使用以下函数循环获取其他文件夹的 Internet 标头
Sub testing()
Dim ns As Outlook.NameSpace
Dim folder As MAPIFolder
Dim item As MailItem
Set ns = Session.Application.GetNamespace("MAPI")
Set folder = ns.GetDefaultFolder(olFolderInbox)
For Each item In folder.Items
If (item.Class = olMail) Then
GetInetHeaders item
End If
Next item
End Sub
Function GetInetHeaders(olkMsg As MailItem) As String
' Purpose: Returns the internet headers of a message.'
' Written: 4/28/2009'
' Author: BlueDevilFan'
' Outlook: 2007'
Const PR_TRANSPORT_MESSAGE_HEADERS = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
Dim olkPA As Outlook.PropertyAccessor
Set olkPA = olkMsg.PropertyAccessor
GetInetHeaders = olkPA.GetProperty(PR_INTERNET_MESSAGE_ID)
Debug.Print olkMsg.Subject
Debug.Print GetInetHeaders
Set olkPA = Nothing
End Function
但是没有在“已发送邮件”文件夹上工作,有没有人对此有经验或参考?
FAIL 属性不返回任何内容
Sub testing2()
Dim item As MailItem
Set Store = Application.GetNamespace("MAPI").Folders
For Each StoreFolder In Store
For i = 1 To StoreFolder.Folders.Count
If StoreFolder.Folders(i).Name = "Sent Items" Then
For Each item In StoreFolder.Folders(i).Items
If (item.Class = olMail) Then
GetInetHeaders item
End If
Next item
Exit For
End If
Next
Exit For
Next
End Sub
编辑如果无法实现,我可以在电子邮件中自己密件抄送。