logo
search
Compliance Problems

How to Find Documents with a Retention Label Using Microsoft Graph

Phi Hung VoPhi Hung Vo Oct 19, 2026 869 views

Question details

The user wants to retrieve all documents assigned to a specific retention label using the Microsoft Graph API.

How to Find Documents with a Retention Label Using Microsoft Graph
Product
Microsoft Graph API
Device & OS
not provided
Scenario
Attempting to query files by retention label via a standard OneDrive drive search endpoint.
Observed behavior
The standard search query does not reliably return documents because retention labels are compliance metadata and are not indexed for standard file search endpoints.
Before you start

Ensure you have the appropriate administrative permissions and Microsoft Purview access, as querying compliance metadata often requires higher-level tenant privileges than standard file read permissions.

Solution 1Recommended

Utilize Microsoft Purview Content Search or eDiscovery

Since standard OneDrive search endpoints do not index retention labels, Microsoft Purview provides robust compliance search capabilities designed specifically to find labeled documents.

Retention labels are considered compliance metadata within the Microsoft ecosystem. Relying on standard drive search endpoints is not recommended for comprehensive compliance audits.

1
Access the compliance portal

Log in to the Microsoft Purview compliance portal using an administrator account with eDiscovery or Content Search privileges.

2
Navigate to Content Search

Select 'Content search' or 'eDiscovery' from the left-hand navigation menu.

3
Configure label conditions

Create a new search query and add a condition to filter by 'Retention label', selecting the specific label ID you want to locate.

4
Run and review

Run the query to generate a report. Once complete, you can review or export the list of documents assigned to that retention label.

Utilize Microsoft Purview Content Search or eDiscovery
Permission Requirements: Running Content Searches requires specific role assignments, such as the eDiscovery Manager role, which must be assigned by a global administrator.
Free Microsoft Office alternative

Manage Your Documents Efficiently with WPS Office

While enterprise compliance and retention labels require complex Microsoft integrations, your daily document creation and editing tasks do not. WPS Office provides a lightweight, highly compatible, and free alternative to Microsoft Office for editing Word, Excel, and PowerPoint files without the enterprise overhead.

  1. 1. Download the software: Visit the official WPS Office website and download the free installation package.
  2. 2. Install WPS Office: Run the downloaded installer and follow the simple on-screen instructions to set up the software.
  3. 3. Edit your documents: Open WPS Office to seamlessly view, edit, and save your DOCX, XLSX, and PPTX documents.
100% compatible with Microsoft Office formats (DOCX, XLSX, PPTX)Free and lightweight alternative to heavy enterprise suitesBuilt-in PDF editing and format conversion toolsFamiliar user interface for a seamless migration experience
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't standard OneDrive search find documents by retention label?

Retention labels are stored as compliance metadata rather than standard file attributes. Because of this, the regular OneDrive file search endpoint does not reliably index or query this information, requiring the use of specialized compliance endpoints like Microsoft Purview.

Can I use Microsoft Graph to apply a retention label to a file?

Yes, Microsoft Graph allows applying retention labels to SharePoint and OneDrive items using the setLabel action on the driveItem endpoint, provided the application or user has the necessary compliance permissions.

Where can I get specialized help for the Microsoft Graph API?

You can post your specific development and API questions in the Microsoft Q&A community using the 'ms-graph' tag, where Microsoft engineers and community experts provide detailed assistance.