我正在尝试使用高级搜索方法来过滤大量电子邮件。我正在考虑最终创建一个过滤器,例如:
filter = "(urn:schemas:mailheader:subject like '%project%' or " _
& "urn:schemas:httpmail:textdescription like '%project%') and " _
& "urn:schemas:mailheader:date > 'now - 1:00:00' and " _
& "urn:schemas:httpmail:hasattachment > 0 and " _
**& "urn:schemas:httpmail:attachmentfilename like '%tonnage%'"**
问题是附件文件名的部分(粗体线)不起作用。我相信这是因为它正在寻找像 olmailitem 之类的东西,而不是该对象的附件。无论如何,我需要一个简单的过滤器来查看附件是否正常工作,然后我可以扩大它。这是我到目前为止所拥有的:
scope = "'Fakeexample123@outlook.com'"
'this is a dumbed down version of my filter,
'but I want it to search for 3 instances of '%attachment%':
'attachment
'Attachment
'ATTACHMENT
'for any .xls, .xlsm, or .xlsx files
'I was thinking something like:
'filter = "ucase(urn:schemas:httpmail:attachmentfilename) like '%ATTACHMENT%xls%'"
'but I don't believe that works... ideas?
filter = "urn:schemas:httpmail:hasattachment > 0 and " _
'***************** This is the line that is giving me trouble *****************
"urn:schemas:httpmail:attachmentfilename like '%attachment%xls%'"
'***************** End trouble *****************
Set AdvancedSearch = myOlApp.AdvancedSearch(scope, filter, True, "test")
如果您有任何想法,请告诉我。