Sub StoreFailedLogs()
Dim i As Long
Dim ItemsCount As Integer
Dim objVariant As Variant
Dim objFolder As Outlook.MAPIFolder
Dim objItem As Object
Dim fso As FileSystemObject
Dim ts As TextStream
' On Error Resume Next
Set fso = New FileSystemObject
Set ts = fso.OpenTextFile("D:\failed_logs_email.txt", ForAppending, True)
Set objFolder = Session.GetDefaultFolder(olFolderInbox).Folders("Logs")
ItemsCount = objFolder.Items.Count
If ItemsCount Then
For i = ItemsCount To 1 Step -1
Set objItem = objFolder.Items.Item(i)
Set objVariant = objItem
If objVariant.MessageClass = "IPM.Note" Then
If objVariant.Subject = "Undeliverable: Logs" Then
With ts
.WriteLine (objVariant.To)
.Close
'objVariant.Delete
End With
End If
End If
Next
End If
Set objFolder = Nothing
Set objVariant = Nothing
Set objItem = Nothing
Set ts = Nothing
Set fso = Nothing
End Sub
Dim objFSO
Dim objTextFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const ForAppending = 8
Set objTextFile = objFSO.OpenTextFile("D:\emails.txt", ForAppending, True)
<property tag = "0x0074001F" type = "PT_UNICODE" >
<Name>PR_ORIGINAL_DISPLAY_TO_W</Name>
<OtherNames>PidTagOriginalDisplayTo, PR_ORIGINAL_DISPLAY_TO, PR_ORIGINAL_DISPLAY_TO_A, ptagOriginalDisplayTo</OtherNames>
<property tag = "0x0E04001F" type = "PT_UNICODE" >
<Name>PR_DISPLAY_TO_W</Name>
<OtherNames>PidTagDisplayTo, PR_DISPLAY_TO, PR_DISPLAY_TO_A, ptagDisplayTo</OtherNames>
Sub StoreFailedLogs()
Dim objItem As Object
Dim fso As FileSystemObject
Dim ts As TextStream
Dim propertyAccessor As Outlook.propertyAccessor
' On Error Resume Next
Set fso = New FileSystemObject
Set ts = fso.OpenTextFile("D:\failed_logs_email.txt", ForAppending, True)
Set objItem = Application.ActiveExplorer.Selection.Item(1)
Set propertyAccessor = objItem.propertyAccessor
Debug.Print propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0074001F")
strTo = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0074001F")
With ts
.WriteLine (strTo)
.Close
End With
Set objItem = Nothing
Set ts = Nothing
Set fso = Nothing
End Sub
Sub StoreFailedLogs()
Dim objItem As Object
Dim fso As FileSystemObject
Dim ts As TextStream
Dim propertyAccessor As Outlook.propertyAccessor
' On Error Resume Next
Set fso = New FileSystemObject
Set ts = fso.OpenTextFile("D:\failed_logs_email.txt", ForAppending, True)
Set objItem = Application.ActiveExplorer.Selection.Item(1)
Set propertyAccessor = objItem.propertyAccessor
Debug.Print propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0074001F")
strTo = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0074001F")
With ts
.WriteLine (strTo)
.Close
End With
Set objItem = Nothing
Set ts = Nothing
Set fso = Nothing
End Sub
objItemsUNDELIVERED_itemAdd
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
O | How to apply view settings on all accounts and folders | Using Outlook | 4 | |
|
How to view all tasks across task folders | Using Outlook | 3 | |
N | Outlook 2013 Folder View | Using Outlook | 8 | |
|
Outlook 2013 Odd Folder View Problem | Using Outlook | 3 | |
Z | Batch Change Folder Views in Outlook 2016 | Using Outlook | 1 |