Share via


Reading Status Messages

There are no SMS methods for reading messages. Instead, you write queries to retrieve the status message instances from SMS_StatusMessage and its child classes, SMS_StatMsgAttributes and SMS_StatMsgInsStrings.

A user-defined message can have elements stored in all three status message classes. Information about the message, such as the MessageType, is stored in the SMS_StatusMessage class. The user name (includes the domain) and other attributes are stored in the SMS_StatMsgAttributes class. Either the message text or the insertion strings of a raw message are stored in the SMS_StatMsgInsStrings class.

Typically, your query will perform a join with more than one class. If the properties you specify in your select list belong to a single class, the query returns the single class object to which the properties belong. For example, if all the properties specified in your select list belong to SMS_StatusMessage, the query returns an SMS_StatusMessage object. Only those properties specified in your select list will contain values.

However, when you specify properties from more than one class in the select list, the query returns a generic class that contains embedded objects for those classes whose properties are specified in the select list. The generic class is called __Generic. For example, this SELECT statement yields the following generic class:

SELECT Msg.Component, Ins.InsStrValue
FROM SMS_StatusMessage Msg JOIN
     SMS_StatMsgInsStrings Ins ON Msg.RecordID = Ins.RecordID


Class __Generic
{
   SMS_StatusMessage      Msg;
   SMS_StatMsgInsStrings  Ins;
};

For more information on how to access the embedded objects, see Reading and Writing Embedded Objects.

Note  A mature site can contain many thousands of status messages, which is why you should limit your query appropriately. During your testing phase, and even in production, you may want to use the InstanceCount context qualifier to limit the number of status message instances returned by your query.

For more information on reading status messages, see the following topics: