mailSearchFolder resource type

Namespace: microsoft.graph

A mailSearchFolder is a virtual folder in the user's mailbox that contains all the email items matching specified search criteria. mailSearchFolder inherits from mailFolder. Search folders can be created in any folder in a user's Exchange Online mailbox. However, for a search folder to appear in Outlook, Outlook for the web, or Outlook Live, the folder must be created in the WellKnownFolderName.SearchFolders folder.

Search folder lifecycle

Search folders created by your application can be deleted by Exchange Online for one of the following reasons:

  1. Search folders expire after 45 days of no usage.
  2. There are limits on the number of search folders that can be created per source folder. When this limit is breached, older search folders are deleted to make way for new ones.

When a search folder is deleted, your app should create a new search folder resource and use the same.

Methods

Method Return Type Description
Create mail search folder mailSearchFolder Create a search folder in this user's mailbox.
List child folders mailFolder collection List all the folders in this user's mailbox, including search folders.
Get mail search folder mailSearchFolder Get the specified search folder.
Update mail search folder mailSearchFolder Update the specified search folder.
Delete mail search folder None Delete the specified search folder.
List messages in folder message collection List all the messages in the specified search folder.

Properties

Property Type Description
filterQuery String The OData query to filter the messages.
includeNestedFolders Boolean Indicates how the mailbox folder hierarchy should be traversed in the search. true means that a deep search should be done to include child folders in the hierarchy of each folder explicitly specified in sourceFolderIds. false means a shallow search of only each of the folders explicitly specified in sourceFolderIds.
isSupported Boolean Indicates whether a search folder is editable using REST APIs.
sourceFolderIds String collection The mailbox folders that should be mined.

JSON representation

The following JSON representation shows the resource type.

{
  "isSupported": true,
  "includeNestedFolders": true,
  "sourceFolderIds": ["string"],
  "filterQuery": "string"
}