Export (0) Print
Expand All

Mailbox.displayMessageForm method (JavaScript API for Office v1.0)

apps for Office

Displays an existing message.

Last modified: February 27, 2015

Office.context.mailbox.displayMessageForm(itemId)

itemId

The Exchange Web Services (EWS) identifier for an existing message.

The displayMessageForm method opens an existing message in a new window on the desktop or in a dialog box on mobile devices.

In Outlook Web App, this method opens the specified form only if the body of the form is less than or equal to 32 KB number of characters.

If the specified item identifier does not identify an existing message, no message will be displayed on the client computer, and no error message will be returned.

Do not use the displayMessageForm with an itemId that represents an appointment. Use the Mailbox.displayAppointmentForm method to display an existing appointment, and Mailbox.displayNewAppointmentForm to display a form to create a new appointment.

The following code example in JavaScript obtains the selected item, checks if the item is a message, and displays it in a message form.

var myOm;
var myItem;

// Initialize runtime.
// The initialize function is required for all apps.
Office.initialize = function () {
    myOm = Office.context.mailbox;
    // Get the selected item.
    myItem = myOm.item;

    // Checks for the DOM to load using the jQuery ready function.
    $(document).ready(function () {
        // After the DOM is loaded, can display content in app UI.
        displaySelectedMessage();
    });
}
function displaySelectedMessage()
{
    // Display selected item only if the item is a message.
    if (myitem.itemType == Office.MailboxEnums.ItemType.Message)
    {
        myOm.displayMessageForm(myItem.itemId);
    }
    else
    {
        alert ("Selected item is not an email message.");
    }
}

Supported clients

Outlook 2013, Outlook 2013 SP1, Outlook 2013 RT, Outlook Web App, OWA for Devices, Outlook for Mac

Library

Outlook-15.js, OutlookWebApp-15.js

Namespace

Office

Show:
© 2015 Microsoft