RegisterFilter Method

The RegisterFilter method registers an IFilter for one or more data sources.

Syntax
HRESULT RegisterFilter(
ULONGcExtensionsNum,
    WCHAR *extensions [],
    ULONGcClassIdsNum,
    CLSID const *classIds [],
    ULONGcMimesNum,
    WCHAR const *mimeTypes [],WCHAR const *pwcsOverride,
    CLSID const *pClsid,
    WCHAR const *pwcsProgid,
    BOOLfFirst,
    WCHAR const *pwcsMachineName,
);
Parameters
  • cExtensionsNum
    [in] A pointer to a ULONG that contains the number of elements in the extensions array parameter.
  • extensions []
    [size_is(cExtensionsNum)] A pointer to an array of pointers to WCHAR that contain file name extensions for which the IFilter is to be registered.
  • cClassIdsNum
    [in] A ULONG that contains the number of elements in the classIds array parameter.
  • classIds []
    [size_is(cClassIdsNum)] An array of pointers to CLSIDs for which the IFilter is to be registered.
  • cMimesNum
    [in] A pointer to ULONG that contains the number of elements in the mimeTypes array parameter.
  • mimeTypes
    [size_is(cMimesNum)] An array of pointers to WCHAR that contain Multipurpose Internet Mail Extensions (MIME) types for which the IFilter is to be registered.
  • pwcsOverride
    [in] A pointer to WCHAR that contains an override string, such as the application name.
  • pClsid
    [in] A pointer to CLSID that contains the class ID of the IFilter being registered.
  • pwcsProgid
    [in] A pointer to WCHAR that contains the program ID (ProgID) of the IFilter being registered.
  • fFirst
    [in] Not used. Value should be 1.
  • pwcsMachineName
    [in] Not used. Value should be 0.
Return Value

For a list of errors returned by SharePoint Portal Server IFilter registration objects, see Error Messages.

Remarks

This method registers the specified IFilter on each of the data source types specified. Each element in the extensions and mimeTypes arrays contains either null or the name of a data source. Each element in the array classIds contains either null or the Class ID of a data source. The parameters cExtensionsNum, cClassIdsNum, and cMimesNum specify how many elements in each array contain valid data sources.

If the fFirst Boolean is true, the IFilter is registered as the highest-precedence filter for each data source type. If the fFirst Boolean is false, the IFilter is added at the end of the list of IFilters registered for each data source type.

If the pwcsOverride string is not null, the method registers the IFilter as being the override filter for the data source types. When the IFilter is loaded with the LoadIFilterFromStorageEx or is searched for with the GetDefaultFilter methods using an override string if an IFilter is registered with that same override string and for the same data source type, it will be returned instead of the IFilter that is not overridden.