SmsTextMessage SmsTextMessage SmsTextMessage SmsTextMessage Class

Definition

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 only available 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: device apps.

Note

Note that this class and its methods are supported for the maintenance of legacy desktop apps that used it in earlier versions of Windows; and if you do use this class, you must specify the Windows.Devices.Sms.LegacySmsApiContract in your app's manifest. Do not use this class if you are developing new apps for Windows 10. Instead, use the members of this namespace that do not require the Windows.Devices.Sms.LegacySmsApiContract.

public : sealed class SmsTextMessage : ISmsMessage, ISmsTextMessage
public sealed class SmsTextMessage : ISmsMessage, ISmsTextMessage
Public NotInheritable Class SmsTextMessage Implements ISmsMessage, ISmsTextMessage
var smsTextMessage = new smsTextMessage();
Attributes
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

Constructors

SmsTextMessage() SmsTextMessage() SmsTextMessage() SmsTextMessage()

Creates an instance of the SmsTextMessage class.

public : SmsTextMessage()
public SmsTextMessage()
Public Sub New()
var smsTextMessage = new smsTextMessage();
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

Properties

Body Body Body Body

Specifies the plain text body of the message.

public : Platform::String Body { get; set; }
public string Body { get; set; }
Public ReadWrite Property Body As string
var string = smsTextMessage.body;
smsTextMessage.body = string;
Value
Platform::String string string string

A string representing the body of the text message. If there were decoding problems, some characters in the original message can be represented by a wildcard character, typically a question mark ('?').

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

Encoding Encoding Encoding Encoding

Specifies the encoding type that has been set to use when sending this message.

public : SmsEncoding Encoding { get; set; }
public SmsEncoding Encoding { get; set; }
Public ReadWrite Property Encoding As SmsEncoding
var smsEncoding = smsTextMessage.encoding;
smsTextMessage.encoding = smsEncoding;
Value
SmsEncoding SmsEncoding SmsEncoding SmsEncoding

A value from the SmsEncoding enumeration.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

From From From From

Specifies the phone number of the sender of the message.

public : Platform::String From { get; set; }
public string From { get; set; }
Public ReadWrite Property From As string
var string = smsTextMessage.from;
smsTextMessage.from = string;
Value
Platform::String string string string

A string representation of the phone number of the sender of this message. It should be in the format preferred by the device and the network it is registered on.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

Id Id Id Id

Indicates the ID of the SMS text message.

public : unsigned int Id { get; }
public uint Id { get; }
Public ReadOnly Property Id As uint
var uint = smsTextMessage.id;
Value
unsigned int uint uint uint

An integer ID for the message.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

MessageClass MessageClass MessageClass MessageClass

Specifies the message class of a message. This message class typically originates on the network, not the mobile device.

public : SmsMessageClass MessageClass { get; }
public SmsMessageClass MessageClass { get; }
Public ReadOnly Property MessageClass As SmsMessageClass
var smsMessageClass = smsTextMessage.messageClass;
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

PartCount PartCount PartCount PartCount

Indicates the total number of parts in the original message if the message is part of a multi-part message.

public : unsigned int PartCount { get; }
public uint PartCount { get; }
Public ReadOnly Property PartCount As uint
var uint = smsTextMessage.partCount;
Value
unsigned int uint uint uint

An unsigned integer. If the message is standalone, the value is 1.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

PartNumber PartNumber PartNumber 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.

public : unsigned int PartNumber { get; }
public uint PartNumber { get; }
Public ReadOnly Property PartNumber As uint
var uint = smsTextMessage.partNumber;
Value
unsigned int uint uint uint

An unsigned integer. It is one-based. It will not exceed PartCount + 1.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

PartReferenceId PartReferenceId PartReferenceId 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.

public : unsigned int PartReferenceId { get; }
public uint PartReferenceId { get; }
Public ReadOnly Property PartReferenceId As uint
var uint = smsTextMessage.partReferenceId;
Value
unsigned int uint uint uint

An unsigned integer determined by the sending network; it cannot be manipulated through this interface. If the network has its own policy on the lifetime of a multi-part message, this reference number might not be valid indefinitely.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

Timestamp Timestamp Timestamp 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.

public : DateTime Timestamp { get; }
public DateTimeOffset Timestamp { get; }
Public ReadOnly Property Timestamp As DateTimeOffset
var dateTimeOffset = smsTextMessage.timestamp;
Value
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

A value of the DateTime type.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

To To To To

Indicates the recipient phone number of this message.

public : Platform::String To { get; set; }
public string To { get; set; }
Public ReadWrite Property To As string
var string = smsTextMessage.to;
smsTextMessage.to = string;
Value
Platform::String string string string

A string representation of the phone number, formatted in the phone number format favored by the device and the network that the device is registered on.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

Methods

FromBinaryData(SmsDataFormat, Byte[]) FromBinaryData(SmsDataFormat, Byte[]) FromBinaryData(SmsDataFormat, Byte[]) 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.

public : static SmsTextMessage FromBinaryData(SmsDataFormat format, Byte[] value)
public static SmsTextMessage FromBinaryData(SmsDataFormat format, Byte[] value)
Public Static Function FromBinaryData(format As SmsDataFormat, value As Byte[]) As SmsTextMessage
var smsTextMessage = Windows.Devices.Sms.SmsTextMessage.fromBinaryData(format, value);
Parameters
format
SmsDataFormat SmsDataFormat SmsDataFormat SmsDataFormat

An SmsDataFormat enumerated value that identifies the format of a particular protocol description unit (PDU) buffer.

value
Byte[] Byte[] Byte[] Byte[]

An array of bytes containing the binary data to decode.

Returns

A new SmsTextMessage object if the decoding was successful.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

FromBinaryMessage(SmsBinaryMessage) FromBinaryMessage(SmsBinaryMessage) FromBinaryMessage(SmsBinaryMessage) FromBinaryMessage(SmsBinaryMessage)

Reads a binary message and decodes it. The results are placed in a new instance of a text message.

public : static SmsTextMessage FromBinaryMessage(SmsBinaryMessage binaryMessage)
public static SmsTextMessage FromBinaryMessage(SmsBinaryMessage binaryMessage)
Public Static Function FromBinaryMessage(binaryMessage As SmsBinaryMessage) As SmsTextMessage
var smsTextMessage = Windows.Devices.Sms.SmsTextMessage.fromBinaryMessage(binaryMessage);
Parameters
binaryMessage
SmsBinaryMessage SmsBinaryMessage SmsBinaryMessage SmsBinaryMessage

An instance of a binary message to decode.

Returns
Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging

ToBinaryMessages(SmsDataFormat) ToBinaryMessages(SmsDataFormat) ToBinaryMessages(SmsDataFormat) ToBinaryMessages(SmsDataFormat)

Reads a message in the specified format and places the results in a new instance of a binary message.

public : IVectorView<ISmsBinaryMessage> ToBinaryMessages(SmsDataFormat format)
public IReadOnlyList<ISmsBinaryMessage> ToBinaryMessages(SmsDataFormat format)
Public Function ToBinaryMessages(format As SmsDataFormat) As IReadOnlyList<ISmsBinaryMessage>( Of ISmsBinaryMessage )
var iVectorView = smsTextMessage.toBinaryMessages(format);
Parameters
format
SmsDataFormat SmsDataFormat SmsDataFormat SmsDataFormat

A value from the SmsDataFormat enumeration.

Returns
IVectorView<ISmsBinaryMessage> IReadOnlyList<ISmsBinaryMessage> IReadOnlyList<ISmsBinaryMessage> IReadOnlyList<ISmsBinaryMessage>

The new binary message that holds the result of this method call.

Additional features and requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Sms.LegacySmsApiContract (introduced v1)
Capabilities
sms cellularMessaging