Search code examples
vstooffice365office365-appsoffice-js

Two-way communication between VSTO add-in and a Task Pane app (JS/HTML)


Is it possible to have a VSTO add-in and a JS/HTML based Task Pane app talk to each other when running inside desktop Office application?

The goal would be to bridge capabilities not yet present (or never will be present) in the x-platform Office APIs using VSTO.


Solution

  • As Evgene mentioned, there is no out-of-the-box functionality for this (though the topic has certainly come up in internal discussions, so I would be very curious to hear your scenario, and particularly how you would handle the VSTO-only-on-the-desktop case).

    If you wanted to try this now, you probably still could with a bit of a creative solution. Imagine you have a hidden sheet with a named range on it, which you use as a communication buffer between VSTO and your taskpane app.

    For VSTO => JS communication: have the taskpane create a binding over the named range, then use the binding-data-changed event to listen to an incoming message from your VSTO add-in.

    For JS => VSTO communication: have the JS set data to the binding (which, as above, was created over the named range). On the VSTO side, listen to data changed event, intersect the incoming range with the named range's range, and if the intersection is not null, fetch the text to get the incoming message.

    If you do end up trying out this approach, do keep the thread posted on how it went -- I'd be quite curious to hear.

    ~ Michael Zlatkovsky (developer on Office Extensibility team)