Outlook Add-In - Problem importing/executing function from different module

25 Views Asked by At

I am developing an Outlook add-in using JavaScript. I am using the Yeoman generator and have modified the manifest.xml, taskpane.html, taskpane.js, commands.js, and command.html files.

My run function (inside taskpane.js) works correctly from taskpane.html, but if I call it from commands.js it doesn't work. It gets blocked showing "Quick Copy with headings is working on your request of Perform an action".

The add-in has a taskpane and a direct command button. The command button executes the action function from the commands.js file. There is probably a small mistake there, but it is my first task in JavaScript and I can't see it.

In the console, I can see: "empty chain passed to getElementById()".

Relevant code:

manifest.xml:

<Action xsi:type="ExecuteFunction">
  <FunctionName>action</FunctionName>
</Action>

taskpane.js:

export async function run() {
  // ... (function code)
}

commands.js:

import { run } from "../taskpane/taskpane";

function action(event) {
  // ... (function code)
  run();
}

I have reviewed Microsoft's documentation on developing Outlook add-ins. I have searched Stack Overflow and other forums, but I have not found a solution to my specific problem. I have tried different ways of calling the run function from commands.js, but none have worked. Question: What am I doing wrong? How can I make the run function execute correctly when the Outlook add-in button is clicked?.

0

There are 0 best solutions below