Hitesh
Hitesh

Reputation: 1228

Open taskpane using runtime URL from ExecuteFuntion in office 365 word addin

I am working on an Office 365 Word addin. I have 2 buttons (Display and Search) on the ribbon.

When clicking the "Display" button, I pass the selected word to my application with a query param and open in task pane, for example:

http://www.myapplication.com?display=[selectedword]

When clicking on the "Search" button, I pass selected word to my application with a query param and open in task pane, for example:

http://www.myapplication.com?search=[selectedword]

To get the selected word I am using ExecuteFunction and based on the selected word I append queryParam to my application URL.

    Office.context.document.getSelectedDataAsync(
                function (result) {
                    if (result.status === Office.AsyncResultStatus.Failed) {
                        onError(result.error);
                    }
                    else {
                       var finalURLToOpenInTaskPane = [myApplicationURL] + '?display=' + result.value;

//TODO Open this URL in taskpane
                    }
                }
            );

I am not sure how can I open this URL with query param in task pane from this ExecuteFunction.

I have tried the below link but in which he is not using query param but he directly uses static URL.

Office web addin addin command send command to taskpane

Thanks in advance

Upvotes: 0

Views: 253

Answers (1)

Rick Kirkham
Rick Kirkham

Reputation: 9684

The URL for the taskpane has to be in the manifest. You can't set it at runtime. I recommend that you design your add-in to use buttons in the task pane instead of buttons on the ribbon.

Upvotes: 0

Related Questions