0

高度な検索方法を使用して、多数のメールをフィルタリングしようとしています。私は最終的に次のようなフィルターを作成することを検討しています:

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")

何か考えがあれば教えてください。

4

1 に答える 1

1

最初に添付ファイルのあるアイテムを検索する必要があります。たとえば、次の条件を使用できます。

  "urn:schemas:httpmail:hasattachment" = 1

Outlook で正しく動作させるには、SQL 構文を使用する必要があります。

  filter = "@SQL=""urn:schemas:httpmail:hasattachment"" = 1"
于 2015-07-27T20:25:15.683 に答える