How can I create a Reply With Outlook mobile Add-in?

Viewed 36

I have a web Outlook Add-in, and there I can compose the body with a HTML:

Office.context.mailbox.item.body.getTypeAsync((result) => {
        if (result.status === Office.AsyncResultStatus.Failed) {
            write(result.error.message)
        } else {
            // Successfully got the type of item body.
            // Set data of the appropriate type in body.
            if (result.value === Office.CoercionType.Html) {
                // Body is of HTML type.
                // Specify HTML in the coercionType parameter
                // of setSelectedDataAsync.
                item.body.setSelectedDataAsync(
                    '<h1>My Html</h1>',
                    { coercionType: Office.CoercionType.Html, asyncContext: { var3: 1, var4: 2 } },
                    (asyncResult) => {
                        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
                            write(asyncResult.error.message)
                        } else {
                            // Successfully set data in item body.
                            // Do whatever appropriate for your scenario,
                            // using the arguments var3 and var4 as applicable.
                        }
                    },
                )
            } else {
                // Body is of text type.
                item.body.setSelectedDataAsync(
                    `Error`,
                    { coercionType: Office.CoercionType.Text, asyncContext: { var3: 1, var4: 2 } },
                    (asyncResult) => {
                        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
                            write(asyncResult.error.message)
                        } else {
                            // Successfully set data in item body.
                            // Do whatever appropriate for your scenario,
                            // using the arguments var3 and var4 as applicable.
                        }
                    },
                )
            }
        }
    })

It work's perfectly on desktop web, but on mobile, I get this error:

Office.context.mailbox.item.body.getTypeAsync is not a function

I tried to use the Office.context.mailbox.item.displayReplyForm but I was told this is not supported on mobile: Outlook Add-in displayReplyForm

How should I proceed? I want a "Reply with" kind of App for mobile. I'm lost! Thanks!

0 Answers
Related