如何将 SentMail 文件夹设置为文件夹?

How to set the SentMail Folder as Folder?

我想导出另一个邮箱的 SentMail 文件夹。

我可以将 olFolderInbox as FolderGetSharedDefaultFolder 一起使用,但不能将 olFolderSentMail

一起使用

我明白了

Runtime Error -2147024809 (80070057)

Dim AttachCount As Long
Dim AttachDtl() As String
Dim ExcelWkBk As Excel.Workbook
Dim FileName As String
Dim FolderTgt As MAPIFolder
Dim HtmlBody As String
Dim InterestingItem As Boolean
Dim InxAttach As Long
Dim InxItemCrnt As Long
Dim PathName As String
Dim ReceivedTime As Date
Dim RowCrnt As Long
Dim SenderEmailAddress As String
Dim SenderName As String
Dim Subject As String
Dim TextBody As String
Dim xlApp As Excel.Application
Dim objNS As NameSpace

Dim Item As Object
Dim varOutput() As Variant
Dim lngcount As Long

Dim olNs As Outlook.NameSpace
Dim olRecip As Outlook.Recipient
Dim SubFolder As Object

Set olNs = Application.GetNamespace("MAPI")
Set olRecip = olNs.CreateRecipient("test@mailbox.de") '// Owner's Name or email address
Set FolderTgt = olNs.GetSharedDefaultFolder(olRecip, olFolderSentMail)
'  Set SubFolder = ShareInbox.Folders("Temp") 'Change this line to specify folder

有时您必须解决 Outlook 中的错误 VBA。

Set FolderTgt = olNs.GetSharedDefaultFolder(olRecip, olFolderInbox)
    
Set FolderTgt = FolderTgt.Parent
    
Set FolderTgt = FolderTgt.folders("Sent Items")
'or
' Set FolderTgt = FolderTgt.folders("Sent")