Setting Filters

To use a filter to specify the objects to retrieve for a container, your application must set the filter on the container before the container is populated. Note that a filter cannot be removed from a container after the filter has been set.

To set a filter on a container, use the SmsSetFilter function to apply the filter to the container. You can set one or more filters on a container. If you do not set a filter, all objects for the container type will be returned when the container is populated.

The type of the filter must be supported by the container. If the filter type is not supported by the container, SmsSetFilter does not apply the filter and returns a status of SMS_INVALID_FILTER_TYPE.

For information about the types of filters supported by each container, see the appropriate topic under Container Types.

SmsSetFilter allows only one filter of each type to be applied to a container. For example, two machine filters cannot be applied to the same filter. If a filter of the same type has already been applied to the container, SmsSetFilter does not apply the filter and returns a status of SMS_DUPLICATE_FILTER.

After SmsSetFilter has been used to set a filter on a container, the container keeps a copy of the filter for its own use. This means that any changes made to that filter will not be reflected in the filter that has been set on the container. After your application applies a filter to a container, it can use the SmsCloseFilter function to free memory used by the filter.

To get the list of filters applied to a container, use the SmsGetAllFilters function.