Options to search content in .msg files saved in SharePoint Online - PowerShell

Nishanth Chakkere 0 Reputation points
2024-07-30T23:20:49.6566667+00:00

Hi,

I had asked this question in a different thread, and was advised to ask it here as it may relate to PowerShell.

I am working on the options available to search the content in .msg files saved in SharePoint Online (SPO). I did some testing and noticed that the out-of-the-box search capabilities available in SPO do not bring up the appropriate search results for .msg files saved in SPO.

My specific use cases are as follows:

Searching emails files by their subject.

Searching email files by the recipient (sent to and cc recipients).

Searching email files by the sender details (name and email address).

Searching email files by specific date or within a date range.

Searching email files that have attachments in them (i.e., the email had files attached to it).

Questions:

  • Are there PowerShell scripts that can be used to customise or optimise the search of .msg files stored in SPO?
  • Are there options available in SPO to obtain better search results for the above scenarios?
  • Is this a good use case for KQL to be used?
  • Does creating more site level filters and verticals in MS Search improve the quality of search?

Thank you.

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,817 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,346 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 45,906 Reputation points
    2024-07-31T02:25:45.8133333+00:00

    Microsoft .msg files can be read by Outlook. You can also process them using PowerShell by creating a COM object: New-Object -comobject outlook.application. But Outlook probably won't be found on any servers, and I'm not sure that it will work properly if it was (if I remember correctly, there are quite a few dependencies on other Office software).

    Is there a reason you're saving .msg files instead of the messages text versions (other than it's easy to do)? I'm not even sure you can save a file as text using Outlook.

    I used to use POP3 to read messages I needed to analyze. Doing so will give you the entire message in either straight text or MIME format (you'll get the message headers and body). Attachments to messages would then be in either Base64 (for plain text messages) or as separate MIME sections.

    There's a MIMEKit module you can use with PowerShell to make working with MIME easier.

    0 comments No comments