Message

The Email Message object represents a message on the BlackBerry device. This class can be created and used when launching the new message screen using the invoke API or for direct interaction with the message list storage function.


Supported Platform(s)

- BlackBerry OS 5.0+
- Ripple Emulator
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
blackberry.message.Message Y Y Y      Y
blackberry.message.Message.find Y Y Y      Y
save Y Y Y      Y
STATUS_UNKNOWN Y Y Y      Y
STATUS_SAVED Y Y Y      Y
STATUS_DRAFT Y Y Y      Y
STATUS_SENT Y Y Y      Y
STATUS_ERROR_OCCURED Y Y Y      Y
PRIORITY_HIGH Y Y Y      Y
PRIORITY_MEDIUM Y Y Y      Y
PRIORITY_LOW Y Y Y      Y
FOLDER_INBOX Y Y Y      Y
FOLDER_SENT Y Y Y      Y
FOLDER_DRAFT Y Y Y      Y
FOLDER_OUTBOX Y Y Y      Y
FOLDER_DELETED Y Y Y      Y
FOLDER_OTHER Y Y Y      Y

Configuration Document Settings

To use all of the API described for this object, you must ensure the following settings are in your configuration document:

You must declare the feature element(s) below in your configuration document:

Feature IDBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
<feature id="blackberry.message" /> Y Y Y      Y
<feature id="blackberry.identity" /> Y Y Y      Y
<feature id="blackberry.find" /> Y Y Y      Y

Permission Elements (PlayBook and BlackBerry 10+)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.


Functions


Constants

Constructors

blackberry.message.Message ([service : blackberry.identity.Service])

The Message object is an instance object, where if a new instance is desired, it must be created using the new keyword.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator


Parameters
service optional parameter that specifies the type of service that is expected. This value can specify the email service to create an email message for. If no parameter is specified the default email service will be used.

Code Example:
<script type="text/javascript">
  var message = new blackberry.message.Message();
  message.toRecipients = "noone@blackberryWidgets.com";
  message.subject = "Hello";
  message.body = "World";
  message.send();
<\script>

Functions

static Message[] blackberry.message.Message.find ([filter : blackberry.find.FilterExpression], [maxReturn : Number], [service : blackberry.identity.Service])


This method looks up the messages that matches the expression provided.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator


Parameters
filter optional parameter that defines the search criteria for the find. If no value is provided the method will return all the Messages on the device for the service provided.
maxReturn optional integer parameter specifying the maximum number of results to return from the find. If no value is specified, it will return all results found.
service optional parameter to define which service you wish to search for your messages. If not provided the default service for messages will be used.

Code Example:
<script type="text/javascript">
  var message = new blackberry.message.Message();
  message.toRecipients = "nobody@blackberryWidgets.com";
  message.subject = "[DRAFT] Hello World";
  message.body = "[DRAFT]Just hanging around. How are you doing?";
  message.folder = blackberry.message.Message.FOLDER_DRAFT;
  message.save();

  var filter = new blackberry.find.FilterExpression("nobody@blackberryWidgets.com", "==", message.toRecipients, true);
  var results = blackberry.message.Message.find(filter); 

<\script>

void save ()


This method will save the changes made to the message object.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator


Code Example:
<script type="text/javascript">
  var message = new blackberry.message.Message();
  message.toRecipients = "nobody@blackberryWidgets.com";
  message.subject = "[DRAFT] An example to show how message.save works";
  message.body = "[DRAFT] Just another message to be saved in the draft folder";
  message.folder = blackberry.message.Message.FOLDER_DRAFT;
  message.save();

<\script>

Constants

static Number STATUS_UNKNOWN


Constant representing the UNKNOWN status. The current status cannot be determined.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number STATUS_SAVED


Constant representing the SAVED status


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number STATUS_DRAFT


Constant representing the DRAFT status


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number STATUS_SENT


Constant representing the SENT status


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number STATUS_ERROR_OCCURED


Constant representing the ERROR status


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number PRIORITY_HIGH


Constant representing a HIGH priority


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number PRIORITY_MEDIUM


Constant representing a MEDIUM priority


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number PRIORITY_LOW


Constant representing a LOW priority


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number FOLDER_INBOX


Constant representing the INBOX folder


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number FOLDER_SENT


Constant representing the SENT folder


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number FOLDER_DRAFT


Constant representing the DRAFT folder


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number FOLDER_OUTBOX


Constant representing the OUTBOX folder


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number FOLDER_DELETED


Constant representing the DELETED folder


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

static Number FOLDER_OTHER


Constant representing an OTHER folder


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Feb 11 2013 14:51:08 GMT-0500 (EST)