Outlook搜索文件夹,用于标记和未回复的电子邮件

我一直在寻找一种解决方案,该解决方案可以在Outlook中为我提供一个搜索文件夹,在该文件夹中可以看到我标记的电子邮件,但我没有答复/转发。

惊讶于Outlook无法提供此功能后,我在网上搜索了解决方案。我没有找到完整的解决方案,因此我将自己粘在了一起,并希望与任何寻求相同事物的人分享。

我发现它很有用,因为有时我标记该电子邮件以便以后使用,但是在其他已标记电子邮件中,它们已经丢失了,我已经回复并标记了这些电子邮件,只是为了提醒自己我需要收件人的回答。

因此,此文件夹会自动搜索我真正需要回答的最重要的电子邮件。

cb943527 回答:Outlook搜索文件夹,用于标记和未回复的电子邮件

这是我发现最适合我的东西:

Sub create_all_not_replied_emails_search_folder()

'not replied flagged emails search folder
'credits https://www.extendoffice.com/documents/outlook/5591-outlook-create-search-folder-for-unreplied.html for giving me the basic idea
'credits to https://stackoverflow.com/users/4539709/0m3r for giving me idea of how to get flagged emails as answer at https://stackoverflow.com/a/43772304/10010199

'delcaring variables so the code is cleaner and compatible with Option Explicit
Dim strScope As String 'variable for Outlook Folder that will be searched
Dim strRepliedProperty As String 'variable for first MAPI property
Dim strRepliedProperty2 As String 'variable for second MAPI property
Dim strFilter As String 'variable for the whole filter
Dim objSearch As Outlook.Search 'variable for the search folder

'Specify the folders to be searched,here it is default inbox
strScope = "'" & Application.Session.GetDefaultFolder(olFolderInbox).FolderPath & "'"


strRepliedProperty = "http://schemas.microsoft.com/mapi/proptag/0x10810003" 'Search filter for unreplied emails. With the parameters not 102 and not 103 will get unreplied and not-forwared emails
strRepliedProperty2 = "http://schemas.microsoft.com/mapi/proptag/0x10900003" 'Sear filter for flagged emails. With parameters not 0 (not flagged) and not 1 (not finished) we get emails that are flagged,but are not finished yet
strFilter = Chr(34) & strRepliedProperty & Chr(34) & " <> 102" & "AND" & Chr(34) & strRepliedProperty & Chr(34) & " <> 103" & "AND" & Chr(34) & strRepliedProperty2 & Chr(34) & " <> 0" & " AND " & Chr(34) & "http://schemas.microsoft.com/mapi/proptag/0x10900003" & Chr(34) & " <> 1" 'this is where the filter is set-up

Set objSearch = Outlook.Application.AdvancedSearch(Scope:=strScope,Filter:=strFilter,SearchSubFolders:=True,Tag:="SearchFolder") 'this is where the folder is created

'Save the search folder
objSearch.Save ("Not Replied Emails Dungeon") 'this is where the folder is saved with the name 'Not Replied Emails Dungeon'
MsgBox "Search folder is created successfully!",vbInformation + vbOKOnly,"Search Folder" 'Notify user that code finished

End Sub
本文链接:https://www.f2er.com/3166409.html

大家都在问