Search for attachments by file extension or words within the attachments

Outlook can find emails with one or more attachments by specifying the "Has Attachments" option.

But how can I search for a specific type of attached file?
e.g. search for emails having .docx, .pdf, .xlsx or .zip files etc.

Is it also possible to only search for text within an attachment and not within the message body?

In short, to search for a specific type, you can type the following search command ext:<extension> manually in the Search field.

  • ext:docx
  • ext:pdf
  • ext:xlsx
  • ext:pptx
  • ext:zip

To limit your search to text within an attachment, you can use the attachment: search command.

  • attachment:outlook
  • attachment:(my search words)

You can also combine these commands and search for specific words inside docx attachments;

  • attachment:(my search words) ext:docx

With these two search commands, you can also do quite some advanced things to further optimize your search results if needed as shown in the examples below.

Instant Search - Find messages with attachments by file extension
A short but effective search command.

Search for multiple attachment types in one search

If you want to search for messages which contain at least 2 specific type of file attachments, you’ll have to enclose your search in round brackets after you specify the ext: search command:

  • ext:(docx pdf)
  • ext:(xlsx zip)

If you want to search for messages which contain at least one of the file types, you must use the OR statement (case sensitive!):

  • ext:(docx OR pdf)
  • ext:(xlsx OR zip)
  • ext:(docx OR pdf OR xlsx OR zip)

Exclude attachment types

If you want to exclude a specific file type from your search, you can use the NOT statement (case sensitive!). This can be useful when you want to search for doc files specifically and not also include docx files in your results.

  • ext:(doc NOT docx)
  • ext:(xls NOT xlsx)

To search for all attachments except for some specific types, you must also include the command hasattachments:yes or you’ll also get all messages without attachments returned:

  • ext:(NOT docx) hasattachments:yes
  • ext:(NOT docx NOT pdf NOT xlsx) hasattachments:yes

Search in attachment and message body text

You can combine this with a regular search term to look in the message itself as well as in the attachment:

  • ext:docx your search text
  • ext:(docx OR pdf) your search text

Search in attachment text only

If you only want to search within the attachment, you’ll have to specify the attachment: field as well:

  • ext:docx attachment:outlook
  • ext:pdf attachment:(search with multiple words)

Search for file types inside zip-files

Sadly, there is no specific search command to also include zip-files which contain a specific file type in the results. For instance, to return all doc-files and all zip-files which contain a doc-file.

You can achieve a close approximation by using an OR statement which searches within the zip-file for a specific word in the contained files (which includes the file extension);

  • ext:(docx) OR (ext:zip attachment:docx)
  • ext:(pdf) OR (ext:zip attachment:pdf)

As said, this won’t be an exact search as it will also return messages with zip-files attached which have files containing the word docx or pdf in them.

Note: For more about using Instant Search commands in Outlook see the guide; Instant Search query commands reference

Sperry Software
Use "BH93RF24" to get a discount when ordering!