Share via


Deleting Status Messages

You can delete any status message using the DeleteByID and DeleteByQuery methods defined in the SMS_StatusMessage class.

Although you can delete any message, be careful deleting messages that were reported by the SMS components. Deleting SMS component messages can provide a false impression of the health of the site.

You pass to the DeleteByID method an array of RecordID values. This method limits you to deleting up to 255 instances and requires you to know which records you want deleted. Deleting records using the DeleteByID method is less resource-expensive, because you delete the records based on the key value, and the number of records is a known, discrete value. The ReturnValue property contains the number of SMS_StatusMessage instances that were deleted.

The DeleteByQuery method is more generic in its use, deleting those records returned by the specified query.

Both delete methods perform cascading deletes on the two child classes, SMS_StatMsgAttributes and SMS_StatMsgInsStrings.

Note  You do not use the delete methods to remove old status messages from the database; SMS is responsible for removing old messages for you. SMS uses the site's status filter rules to remove outdated messages automatically. For information on configuring the status filter rules, see the SMS Administrator's Guide.