获取答复日期

问题描述 投票:0回答:1

Is there any way to get the date time on the “you replied to this message on [xxx]”?的答案描述了具有属性PR_LAST_VERB_EXECUTION_TIME的解决方案。

如果属性列表中没有该属性,我可以找到日期或消息答案吗?

程序“ outlookSpy”的“获取道具”窗口中只有属性PR_LAST_VERB_EXECUTED。

Sub Extracting()
Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myFolder, ssBox As Outlook.Folder
Dim sch As Outlook.Search
Dim rsts As Outlook.Results
Dim sDate, eDate, strS, strF, DatiRe As String
Dim i As Integer

Set myolApp = GetObject(, "Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set mySheet = xlApp.Worksheets("Ëèñò1")
sDate = Format(Date, "dd.mm.yyyy")
eDate = Format(Date, "dd.mm.yyyy")
i = 1
While i <= myNamespace.Folders.Count
 If myNamespace.Folders.Item(i).Name = "[email protected]" Then
   Set myFolder = myNamespace.GetFolderFromID(myNamespace.Folders.Item(i).EntryID, myNamespace.Folders.Item(i).StoreID)
   i = myNamespace.Folders.Count
 End If
 i = i + 1
Wend

blnSearchComp = False
Set ssBox = myFolder.Folders("Inbox")
strS = "'" & ssBox.FolderPath & "'"
strF = "urn:schemas:httpmail:datereceived >= '" & sDate & " 0:00' AND urn:schemas:httpmail:datereceived <= '" & eDate & " 23:59'"
Set sch = myolApp.AdvancedSearch(strS, strF, False, "aaa")
While blnSearchComp = False
    DoEvents
Wend
Set ssBox = myFolder.Folders("Outbox")
Set rsts = sch.Results
For i = 1 To rsts.Count
    Debug.Print rsts.Item(i).SenderName
    DatiRe = GetDaTiAnswer(rsts.Item(i).ConversationIndex, rsts.Item(i).ConversationTopic, ssBox.FolderPath)
    Set NextRow = mySheet.Range("A" & mySheet.Rows.Count).End(-4162).Offset(1)
    NextRow.Resize(, 4).Value = Array(rsts.Item(i).SenderEmailAddress, rsts.Item(i).ReceivedTime, DatiRe, rsts.Item(i).Subject)
Next
End Sub

Function GetDaTiAnswer(ByVal iConvIndex, iConvTopic, parP As String) As String
 Dim oApp As Outlook.Application
 Dim oSch As Outlook.Search
 Dim oRes As Outlook.Results
 Dim parC As String
 Dim j As Integer
 blnSearchComp = False
 Set oApp = GetObject(, "Outlook.Application")
 parC = "http://schemas.microsoft.com/mapi/proptag/0x0070001F = '" & iConvTopic & "'"
 Set oSch = oApp.AdvancedSearch("'" & parP & "'", parC, False, "aaa")
 While blnSearchComp = False
    DoEvents
 Wend
 Set oRes = oSch.Results
 For j = 1 To oRes.Count
    Debug.Print oRes.Item(j).SenderName
    If Left(oRes.Item(j).ConversationIndex, Len(oRes.Item(j).ConversationIndex) - 10) = iConvIndex Then
      GetDaTiAnswer = oRes.Item(j).SentOn
    End If
Next
End Function
vba outlook-vba
1个回答
0
投票

根据http://msdn.microsoft.com/en-us/library/office/aa172005(v=office.11).aspx,您应该可以访问PR_CLIENT_SUBMIT_TIME,它是MailItem.SentOn属性。

因此,如果您在已发送的邮件中找到了邮件,那就是要查找的属性。

© www.soinside.com 2019 - 2024. All rights reserved.