Mailbox.displayNewAppointmentForm method (JavaScript API for Office)

Office Add-ins

Displays a form for creating a new calendar appointment.

Last modified: July 06, 2015

Note Note

The name "apps for Office" is changing to "Office Add-ins". During the transition, the documentation and the UI of some Office host applications and Visual Studio tools might still use the term "apps for Office". For details, see New name for apps for Office and SharePoint.

Hosts:Outlook

App type: Mail

Available in requirement sets

Mailbox

Last changed in Mailbox

1.0

Applicable Outlook modes

Read

See all support details

Office.context.mailbox.displayNewAppointmentForm({
requiredAttendees,
optionalAttendees,
start,
end,
location,
resources,
subject,
body})

requiredAttendees

An array of strings containing the email addresses or an array containing an EmailAddressDetails object for each of the required attendees for the appointment. The array is limited to a maximum of 100 entries.

optionalAttendees

An array of strings containing the email addresses or an array containing an EmailAddressDetails object for each of the optional attendees for the appointment. The array is limited to a maximum of 100 entries.

start

A Date object specifying the start date and time of the appointment.

end

A Date object specifying the end date and time of the appointment.

location

A string containing the location of the appointment. The string is limited to a maximum of 255 characters.

resources

An array of strings containing the resources required for the appointment. The array is limited to a maximum of 100 entries.

subject

A string containing the subject of the appointment. The string is limited to a maximum of 255 characters.

body

The body of the appointment message. The body content is limited to a maximum size of 32 KB.

The displayNewAppointmentForm method opens a form that enables the user to create a new appointment or meeting. If parameters are specified, the appointment form fields are automatically populated with the contents of the parameters.

In Outlook Web App and OWA for Devices, this method always displays a form with an attendees field. If you do not specify any attendees as input arguments, the method displays a form with a SAVE button. If you have specified attendees, the form would include the attendees and a SEND button.

In the Outlook rich client and Outlook RT, if you specify any attendees or resources in the requiredAttendees, optionalAttendees, or resources parameter, this method displays a meeting form with a Send button. If you don't specify any recipients, this method displays an appointment form with a Save & Close button.

If any of the parameters exceed the specified size limits, or if an unknown parameter name is specified, an exception is thrown.

The following code example in JavaScript sets up the parameters and displays a form for a new appointment.

var myOm;

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

    // 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.
        displayFormForNewAppointment();
    });
}
function displayFormForNewAppointment()
{
    var formParameters =
    {
        "requiredAttendees" : ["wendy@contoso.com", "derek@contoso.com"],
        "optionalAttendees" : ["shane@contoso.com", "michael@contoso.com"],
        "start" : new Date("September 27, 2012 11:15:00"),
        "end" : new Date("September 27, 2012 12:30:00"),
        "location" : "Conf room 200",
        "resources" : ['sound', 'lighting', 'recording'],
        "subject" : "Next rehearsal",
        "body" : "This is about the next rehearsal."
    }

    // Display a form to create an appointment with
    // the specified parameters.
    myOm.displayNewAppointmentForm(formParameters);
}

A checkmark (√) in the following table indicates that this property is supported in the corresponding Outlook host application. An empty cell indicates that the Outlook host application doesn't support this property.

For more information about Office host application and server requirements, see Requirements for running apps for Office.

Supported hosts, by platform

Office for Windows desktop

Office Online
(in browser)

OWA for Devices

Office for Mac

Outlook

√ (Read mode only)

Available in requirement sets

Mailbox

Minimum permission level

ReadItem

App types

Mail

Library

Office.js

Namespace

Office

Version

Changes

1.0

Introduced

Show:
© 2015 Microsoft