Exclude toast messages from OCS archiving report

The OCS team blog has a post with a script for retrieving messages from the archiving database. As is, the script will retrieve both the plain text version of the first message in a new conversation (as seen in the toast) and the RTF version that is displayed in the conversation window. The output of the report, however, doesn’t distinguish between the toast message and the RTF message, so it just looks like it is a duplicate message.

I have done some testing, and both versions are logged in the database even if you ignore the toast or decline the conversation. I can’t think of a case where you will only have the toast logged and not the full message, so I have excluded all toast messages from my copy of the script. To add this exclusion yourself, add AND LcsLog.dbo.Messages.Toast IS NULL to the SQL queries on lines 23 and 28 before the UNION operator and before the ORDER BY clause at the end, for a total of four times.

2 thoughts on “Exclude toast messages from OCS archiving report

  1. It is because the field isn’t populated with a value unless it is a toast message. So the field doesn’t have anything it is for regular messages, rather than being populated with something that equates to it not being a toast message.

Leave a Reply

Your email address will not be published. Required fields are marked *