0

I'm trying to send an email using the Outlook's office.js API's item.sendAsync() method which triggers on custom send button added on taskpane from a task pane add-in. However, I'm getting a Host Error with the following response:

{
  "code": 5000,
  "message": "The operation is not supported.",
  "name": "Host Error"
}

Here is the code snippet I am using

item.sendAsync((result) => {
    if (result.status === Office.AsyncResultStatus.Succeeded) {
        document.getElementById('review-message').innerHTML = 
            '<p class="ms-font-xs" style="color: green;">✅ Email sent successfully via sendAsync!</p>';
        
        // Close task pane after short delay
        setTimeout(() => {
            if (window.close) {
                window.close();
            }
        }, 2000);
    } else {
        console.error('sendAsync failed:', result.error);
        const error = result.error;
    }
});

I am using it on Outlook for Mac (version 16.102) Also I have added below permission in mainfest.xml

  <Permissions>ReadWriteMailbox</Permissions>

I want to acheive below functionality in my addIn

  1. Display email data on taskpane also having custom send button
  2. send from custom send button available in taskpane (so above code snippet is triggered on button click)
1
  • sendAsync() probably causing this error because you are triggering this function on a button in UI, while sendAsync() method only works in compose mode and can only be triggered UI-less command function (from the ribbon) although it cannot be called from the UI. Commented Sep 23 at 8:54

1 Answer 1

0

The api you are trying to use is in Mailbox 1.15 Requirement Set (https://learn.microsoft.com/en-us/javascript/api/outlook/office.appointmentcompose?view=outlook-js-preview#outlook-office-appointmentcompose-sendasync-member(1)) which isn't yet fully implemented on Outlook for Mac which is likely the cause here.

Sign up to request clarification or add additional context in comments.

1 Comment

is there any option similar functionality ( to send on click of send button from taskpane) can be acheived in outlook for mac ( for Mailbox 1.14 or below) ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.