SPMobileMessageSmsBuilder.EndTextMessage method (Int32, Boolean, Int32)

Completes a text message building transaction.

Namespace:  Microsoft.SharePoint.MobileMessage
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public bool EndTextMessage(
	int maxPagesPerChunk,
	bool hasPageNo,
	int maxPages


Type: System.Int32

The maximum number of pages into which a chunk of text may be split. For more information, see AddChunk(String).

Type: System.Boolean

true to indicate that page numbers are being added when a chunk is split into multiple pages; otherwise, false.

Type: System.Int32

The maximum number of pages allowed in the whole message.

Return value

Type: System.Boolean
true if all the intended text was included in the message; otherwise, false.


The object returned by the Message property is not an SPMobileMessageSmsBuilder object.

A call of one of the overloads of EndTextMessage() is the final part of a text message building transaction. The transaction begins with a call of StartTextMessage(). One or more calls of AddChunk(String) constitute the middle part of the transaction.

The method will attempt to create a SPMobileMessageContentPart from each chunk created by a call of AddChunk(String) in the middle part of the transaction. Since each content part becomes a child SMS message, it must not exceed the character limit imposed by the messaging service. Chunks that exceed the limit will be split into multiple content parts.

Every SPMobileMessageContentPart object that is created is added to ContentParts. Each of these will become a page of the parent message on the mobile device. However, if any chunk is so large that it cannot be split into fewer than maxPagesPerChunk+1 pages, the excess text in the chunk is discarded and not sent. Moreover, if the maxPages limit is reached or the number of content parts reaches the limit imposed by the service provider, no further content parts are made and the remainder of the chunks are discarded and not sent. If any chunk is not made into a content part, or any text of a chunk is not included in any content part, the method returns false.