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.