How to use Targeted Collections with Microsoft 365 Content Searches
Author: Tony Redmond
A better approach is to use a technique called targeted collections. This is a method to set a precise scope for a content search against mailboxes or SharePoint Online and OneDrive for Business sites. In other words, you can define the exact mailbox folders or document library folders to search.
The documentation includes a PowerShell script to demonstrate how to extract folder identifiers and document links. In the remainder of this article, I explain how I adapted the Microsoft script to handle the need to retrieve the contents of the Recoverable Items folders.
Before the script can work with content searches, it must connect to the compliance endpoint by running the Connect-IPPSSession cmdlet. To create a content search, we need to know the content (KQL) query and the search locations. The script computes the query, and we can add the target mailbox as the search location.
In addition to content searches, targeted collections work with the searches used by Microsoft Purview eDiscovery (standard and premium) cases.
As usual Tony Redmond dives right into the M365 Powershell complexity to show how to selectively retrieve specific mailbox or SharePoint folders. While useful, it begs the question of why the folder names are not an addressable search property from the actual Content or eDiscovery Purview interfaces? If you have retrieved the FolderID using this method you can search for that property via Purview directly. But most large corporation lock down who can run PowerShell scripts because they are VERY powerful. Most lit support managers that I have worked with have to put in a ticket to get those FolderIDs. Why? Hopefully this kind of practical selective search will appear on the Microsoft road map soon.