question

IG-4542 avatar image
0 Votes"
IG-4542 asked KaelYao-MSFT commented

Content Search Query (Compliance Search & Attachments)

The Compliance Search "ContentMatchQuery" property can search for whether emails have attachments (hasattachment:true) and the names of attachments (attachmentnames:annualreport.ppt), but is there a way in which it can search the content inside of email attachments?

windows-server-powershelloffice-exchange-server-administrationmicrosoft-graph-compliance
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hi IG-4542,

This is possible. First, you will need to find the name of your DiscoveryMailbox:

Get-Mailbox –RecipientTypeDetails DiscoveryMailbox | export-csv c:\temp\disc.csv



Then run the below PowerShell code:

$UserCredential = Get-Credential

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/" -Credential $UserCredential -Authentication "Basic" -AllowRedirection

Import-PSSession $exchangeSession -DisableNameChecking

Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery 'Subject:"Some Text"' -targetmailbox "DiscoverySearchMailbox{Your ID number}" -targetfolder "SearchResult" -logonly -loglevel full

Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery 'Body:"Some Text"' -targetmailbox "DiscoverySearchMailbox{Your ID number}" -targetfolder "SearchResult" -logonly -loglevel full



You then need to add the DiscoverySearchMailbox to your Outlook to see the results.




--If the reply is helpful, please Upvote and Accept as answer--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KaelYao-MSFT avatar image
0 Votes"
KaelYao-MSFT answered KaelYao-MSFT commented

Hi @IG-4542

According to this link: Keyword queries and search conditions for eDiscovery
There isn't a property which can be used for attachment contents.

Thus I am afraid it is not possible.


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @IG-4542

Just checking in to see if above information was helpful. Please let us know if you would like further assistance.

0 Votes 0 ·