SmsTextMessage Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Manages a decoded SMS text message, providing direct access to the plain text body of the message, as well as key header properties, such as time stamp.
Note
This functionality is available only to mobile operator apps and UWP apps given privileged access by mobile network operators, mobile broadband adapter IHV, or OEM. For more information, see Mobile Broadband.
Note
This class and its methods are supported for the maintenance of legacy desktop apps that used it in earlier versions of Windows. If you do use this class, then you must specify the Windows.Devices.Sms.LegacySmsApiContract in your app's manifest. Don't use this class if you're developing a new app for Windows. Instead, use the APIs in this namespace that don't require the Windows.Devices.Sms.LegacySmsApiContract.
public ref class SmsTextMessage sealed : ISmsTextMessage
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Devices.Sms.LegacySmsApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Devices.Sms.LegacySmsApiContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("SmsTextMessage may be altered or unavailable for releases after Windows 10. Instead, use SmsTextMessage2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Devices.Sms.LegacySmsApiContract)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SmsTextMessage final : ISmsTextMessage
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Devices.Sms.LegacySmsApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Devices.Sms.LegacySmsApiContract")]
/// [Windows.Foundation.Metadata.Deprecated("SmsTextMessage may be altered or unavailable for releases after Windows 10. Instead, use SmsTextMessage2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Devices.Sms.LegacySmsApiContract")]
class SmsTextMessage final : ISmsTextMessage
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Devices.Sms.LegacySmsApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Devices.Sms.LegacySmsApiContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("SmsTextMessage may be altered or unavailable for releases after Windows 10. Instead, use SmsTextMessage2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Devices.Sms.LegacySmsApiContract))]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class SmsTextMessage : ISmsTextMessage
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Devices.Sms.LegacySmsApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Devices.Sms.LegacySmsApiContract")]
[Windows.Foundation.Metadata.Deprecated("SmsTextMessage may be altered or unavailable for releases after Windows 10. Instead, use SmsTextMessage2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Devices.Sms.LegacySmsApiContract")]
public sealed class SmsTextMessage : ISmsTextMessage
function SmsTextMessage()
Public NotInheritable Class SmsTextMessage
Implements ISmsTextMessage
- Inheritance
- Attributes
- Implements
Windows requirements
Device family |
Windows Desktop Extension SDK (introduced in 10.0.10240.0)
|
API contract |
Windows.Devices.Sms.LegacySmsApiContract (introduced in v1.0)
|
App capabilities |
cellularMessaging
sms
|
Constructors
SmsTextMessage() |
Creates an instance of the SmsTextMessage class. |
Properties
Body |
Specifies the plain text body of the message. |
Encoding |
Specifies the encoding type that has been set to use when sending this message. |
From |
Specifies the phone number of the sender of the message. |
Id |
Indicates the ID of the SMS text message. |
MessageClass |
Specifies the message class of a message. This message class typically originates on the network, not the mobile device. |
PartCount |
Indicates the total number of parts in the original message if the message is part of a multi-part message. |
PartNumber |
Indicates the part number of a multi-part message if this message is part of a multi-part message. It can be used to reconstruct the original message by joining the parts together, in conjunction with the PartReferenceId and PartCount properties. |
PartReferenceId |
Indicates a reference value that can be used if the message is part of a multi-part message. If this message belongs to a multi-part message, the PartNumber value can be used to reconstruct the full original message, and each part of that message will have the same value for PartReferenceId. |
Timestamp |
Indicates the timestamp of the message. It is determined locally for a constructed message instance or from the service center timestamp of a received message. |
To |
Indicates the recipient phone number of this message. |
Methods
FromBinaryData(SmsDataFormat, Byte[]) |
Decodes a binary message and places the results in a new instance of a text message. This method represents the binary message as a reference to a buffer of bytes and a selection of how the buffer is encoded. Therefore, it can be used when the message did not originate directly from the device or as an instance of an SmsBinaryMessage class. |
FromBinaryMessage(SmsBinaryMessage) |
Reads a binary message and decodes it. The results are placed in a new instance of a text message. |
ToBinaryMessages(SmsDataFormat) |
Reads a message in the specified format and places the results in a new instance of a binary message. |