Share via


GetFilter Method

Gets the appropriate filter according to the parameters that are supplied.

HRESULT GetFilter(
CLSID *pclsidObj,
LPCWSTR pcwszContentType,
LPCWSTR pcwszExtension,
IFilter **ppFilter
);

Parameters

pclsidObj

[in] Pointer to the class ID (CLSID) for the document type from the registry. This pointer indicates the appropriate filter to use for an embedded document in an item.

pcwszContentType

[in] Pointer to a null-terminated, Unicode string that contains the type of the document. This pointer is used to retrieve filters that are mapped according to the Multipurpose Internet Mail Extensions (MIME) type.

pcwszExtension

[in] Pointer to a null-terminated, Unicode string that contains the file name extension, without the preceding period. This pointer is used to retrieve filters that are mapped to the specified file name extension.

ppFilter

[out] Address of the pointer to the filter used by the protocol handler.

Return Value

If successful, returns S_OK; otherwise, returns an error value. For a list of error messages returned by Enterprise Search in Microsoft Office SharePoint Server 2007, see Protocol Handler Error Messages.

Remarks

If a protocol handler requires a filter for an embedded document, it can get it by calling this method. This method queries the Filter Daemon for the appropriate filter to use for the content item.

The choice of filter is based on the file name extension, a CLSID that identified the file's content in the registry, or on the MIME content type. You must provide only one of the three parameters. If you provide multiple parameters, they are tested in the following order:

  1. pcwszContentType

  2. pclsidObj

  3. pcwszExtension

The method uses the first valid parameter to select the appropriate filter; the method ignores the others.

See Also

Concepts

Protocol Handler Reference
IProtocolHandlerSite Interface