Share via


IMAPIFolder::SetSearchCriteria (Compact 7)

3/12/2014

This method establishes the search criteria for a folder.

Syntax

HRESULT SetSearchCriteria(
  LPSRestriction lpRestriction,
  LPENTRYLIST lpContainerList,
  ULONG ulSearchFlags
); 

Parameters

  • lpRestriction
    [in] Pointer to an SRestriction structure that defines the search criteria. If this parameter is NULL, the most recent search criteria for this container are used again. NULL must not be passed in this parameter on the container's first search.
  • lpContainerList
    [in] Ignored.
  • ulSearchFlags
    [in] Ignored.

Return Values

The following table shows the possible return values.

Value Description

S_OK

The method succeeded.

MAPI_E_TOO_COMPLEX

The MAPI service provider does not support the specified search criteria.

E_FAIL

The method failed due to an unspecified error.

E_INVALIDARG

The method failed because one or more of the arguments is not valid.

E_OUTOFMEMORY

The method failed because it needs more memory resources.

E_UNEXPECTED

The method failed due to an unexpected error.

Remarks

This method sets the search criteria for a container that supports searches, such as a search results folder. The search results folder only contains links to the messages that meet the search criteria. The message text is stored in the original location. The only unique data contained in a search results folder is its contents table, which contains the merged contents of the message store after the search criteria is applied.

A search operation works only on the merged contents table; it does not search through other search results folders. The search results only return the messages that match the search criteria; the folder hierarchy is not returned. Control is returned to the client application when the search is finished.

When the search results folder is longer needed, you can either delete the folder or let it remain open for later use. If you delete the search results folder, the links to the messages are deleted and the messages remain in their parent folders. For more information on search results folders, see MAPI Search Folders.

If your application implements the search used in this call, you should support open, copy, move, and delete operations on the messages in the search results folders. You should not support open, copy, move and delete operations on the search results folder itself. Messages must not be created or copied into a search-results folder.

See Also

Reference

IMAPIFolder
IMAPIContainer::GetContentsTable
IMAPIContainer::OpenEntry
IMAPIFolder::CreateFolder
SPropertyRestriction