For more information about specifying these optional input parameters, see passing optional parameters to asynchronous methods in Asynchronous programming in Office Add-ins. In addition to coercionType, as with most asynchronous methods in the Office JavaScript API, getTypeAsync, prependAsync and setSelectedDataAsync take other optional input parameters. If you attempt to insert the HTML data with Office.Mailbo圎 as coercionType, you will get an error. If you simply insert the HTML data with a text coercion type, the application would display the HTML tags as text. If your data to insert is HTML and getTypeAsync returns a text type for that item, reorganize your data as text and insert it with Office.Mailbo圎 as coercionType. On tablets and smartphones, getTypeAsync returns Office.Mailbo圎 if the operating system or application does not support editing an item, which was originally created in HTML, in HTML format. If you don't specify an argument, prependAsync and setSelectedDataAsync assume the data to insert is in text format. Then set the coercionType parameter of prependAsync or setSelectedDataAsync accordingly (2) to insert the data, as shown in the following table.
The value that getTypeAsync returns depends on the original item format, as well as the support of the device operating system and application to editing in HTML format (1). Before inserting, you should always first verify the supported item format by calling getTypeAsync, as you may need to take additional steps. In Outlook, a user can create a message in text, HTML, or Rich Text Format (RTF), and can create an appointment in HTML format. To use these methods, make sure you have set up the add-in manifest appropriately so that Outlook activates your add-in in compose forms, as described in Create Outlook add-ins for compose forms. These asynchronous methods are available to only compose add-ins. You can use the asynchronous methods ( Body.getAsync, Body.getTypeAsync, Body.prependAsync, tAsync and tSelectedDataAsync) to get the body type and insert data in the body of an appointment or message item that the user is composing.