3.1.4.4 Setting Up a Search Folder

The client creates a search folder by using the RopCreateFolder ROP ([MS-OXCROPS] section 2.2.4.2) with the FolderType field set to the value 2, as specified in section 2.2.1.2.1. For details about creating a folder, see section 3.1.4.2.

The client fills a search folder by applying search criteria and a search scope to the search folder. The search criteria determine which messages are included in the folder, and the search scope determines the folders that are searched.

To set the search criteria and search scope for a search folder, the client sends a RopSetSearchCriteria ROP request ([MS-OXCROPS] section 2.2.4.4) with bits of the SearchFlags field set to control the details of how the search is performed, as specified in section 2.2.1.4.1. The ROP request includes restrictions to specify the search criteria and FIDs ([MS-OXCDATA] section 2.2.1.1) to specify the search scope. A search folder cannot be included in its own search scope. Therefore, the FolderIds field MUST NOT include the FID of the search folder.

To access the results of a search, the client sends a RopGetContentsTable ROP request ([MS-OXCROPS] section 2.2.4.14) to obtain the contents table of the search folder, as specified in section 3.1.4.10. The messages that match the search criteria are specified in the table.

When the client is finished using a search folder, the folder can either be deleted or remain open for later use. Note that if the search folder is deleted, only message links are deleted. The actual messages remain in their parent folders.