juliushuck
juliushuck

Reputation: 1684

Office web addin addin command send command to taskpane

When the user clicks a button in the ribbon, I want to open the taskbar (when it is not opened already) and then I want to execute code depending on which button in the ribbon was clicked.

I m using vue.js for the taskpane.

Upvotes: 0

Views: 278

Answers (1)

Rick Kirkham
Rick Kirkham

Reputation: 9659

I haven't tried this, but it's a suggestion that's too complicated to put into a comment:

For each button, add the <ExtensionPoint> and <Control> markup in the add-in's manifest. Details are in Create Add-in Commands. Set the Action type to ShowTaskpane for all the buttons. For each of the actions, set the <SourceLocation>'s resid to a different string. Then in the <Resources><Urls> section, set each of the resid strings to the URL of the taskpane page, but have a different query parameter on the end of each of them.

<bt:Urls>
    <bt:Url id="residButton1" DefaultValue="https://contoso.com/Home.aspx?Button1">
    <bt:Url id="residButton2" DefaultValue="https://contoso.com/Home.aspx?Button2" />
</bt:Url>

Then have startup logic in the taskpane page that reads the query parameter to determine which button was pressed. The startup logic can be in a function assigned to Office.initialize or in a callback to Office.onReady.

Upvotes: 1

Related Questions