title: Finding attachments with dav queries using AdvancedSearchMethod
body: <p>I'm attempting to use the advanced search method to filter through large numbers of emails. I am looking at ultimately creating a filter like:</p>
  <pre><code>filter = &quot;(urn:schemas:mailheader:subject like '%project%' or &quot; _ 
  &amp; &quot;urn:schemas:httpmail:textdescription like '%project%') and &quot; _
  &amp; &quot;urn:schemas:mailheader:date &gt; 'now - 1:00:00' and &quot; _
  &amp; &quot;urn:schemas:httpmail:hasattachment &gt; 0 and &quot; _
  **&amp; &quot;urn:schemas:httpmail:attachmentfilename like '%tonnage%'&quot;** 
   
  </code></pre>
  <p>The problem is that the part for the attachment's filename (line in bold) does not work. I believe this is because it is looking for something like the olmailitem and not the attachment to that object perhaps. Anyway, I need to get a simple filter that looks at attachments working and then I can scale it up. This is what I have so far:</p>
  <pre><code>scope = &quot;'Fakeexample123@outlook.com'&quot;
      
  '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 = &quot;ucase(urn:schemas:httpmail:attachmentfilename) like '%ATTACHMENT%xls%'&quot;
      'but I don't believe that works... ideas?
      
      filter = &quot;urn:schemas:httpmail:hasattachment &gt; 0 and &quot; _ 
  '***************** This is the line that is giving me trouble *****************
      &quot;urn:schemas:httpmail:attachmentfilename like '%attachment%xls%'&quot;
  '***************** End trouble *****************
      Set AdvancedSearch = myOlApp.AdvancedSearch(scope, filter, True, &quot;test&quot;)
  </code></pre>
  <p>Let me know if you have any thoughts please.</p>