In the ribbon manifest, I can declare a function to execute when a ribbon button is clicked. For example,
<Action xsi:type="ExecuteFunction">
<FunctionName>doSomething</FunctionName>
</Action>
However, if I have a typescript file that has the following definition:
class MyFunctions {
public static doSomething(){
Office.context.ui.displayDialogAsync("https://localhost:44337/index.html",
{ height: 50, width: 50 }
}
}
The following would not work:
<Action xsi:type="ExecuteFunction">
<FunctionName>MyFunctions.doSomething</FunctionName>
</Action>
It's as if it does not recognize dotted names in the manifest file which in this case is ClassName.FunctionName.
MyFunctions.doSomething doesn't work because TypeScript compiler translates to it to a function (i.e. typeof MyFunctions == 'function')
Currently Office Add-in manifest only supports:
Therefore, if MyFunctions is an object, the manifest will work. Here is one example:
var MyFunctions = {
doSomething: function() {}
};
Hopefully this problem will be fixed in the next release. Thanks.