What I am going to do is to add a custom command button to execute a JavaScript function in Microsoft Office(Word or Excel).
Specifically, I need to build a command to copy the link of an opened document file(Word/Excel).
I was able to build an add-in with taskpane using Office Add-in like the following image.
But can I build a command button without taskpane?
Ideally, a command button should copy the link of an opened document file and show success dialog.
The command button also should be used for a registered app in Azure Active Directory.
UPDATE
Regarding the documentation, it says I could use action xsi:type as ExecuteFunction rather than using ShowTaskpane, but it is not working as well.
<?xml version="1.0" encoding="utf-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
...
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3000/commands.js" />
</DefaultSettings>
...
<Host xsi:type="Document">
<!-- Form factor. Currenly only DesktopFormFactor is supported. We will add TabletFormFactor and PhoneFormFactor in the future-->
<DesktopFormFactor>
...
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<!--Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab -->
<!-- Documentation includes all the IDs currently tested to work -->
<CustomTab id="Contoso.Tab1">
...
<Action xsi:type="ExecuteFunction">
<!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file-->
<FunctionName>writeText</FunctionName>
</Action>
</Control>
...
Is this available?