OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
686 stars 95 forks source link

Word: Addin is not auto-loading in Word Online with custom WOPI host #422

Closed stowellt closed 1 year ago

stowellt commented 5 years ago

Expected Behavior

If an addin is inserted into a document, and visibility=1 in taskpanes.xml in the docx file, the addin should auto install when the document is opened in Word Online. image

Current Behavior

If the document is opened in OneDrive, the addin is auto loaded. If the document is opened in a Wopi Host, the addin never tries to load.

Steps to Reproduce, or Live Example

Context

We have created a custom addin and need it to auto load in users documents when editing on a custom Wopi host

Your Environment

Useful logs

Screenshots

weshi commented 5 years ago

@lliu113 is this related to your area?

vinay-sattur commented 4 years ago

Is there any update on this. I am also facing the same issue. I am developing an excel add-in, it loads automatically when the file is opened fro OneDrive but not loading automatically when file is opened with WOPI.

AndyHore commented 3 years ago

Looking for an update on this. This is a MAJOR problem and miss on functionality for WOPI that our customers require.

lliu113 commented 3 years ago

This looks like an issue with custom WOPI hosts, so looping in @keyur32

@stowellt - have you tried the auto-open taskpane feature? You need to tag the document, and the pane should automatically open. Thinking it might suffice as a workaround. https://docs.microsoft.com/en-us/office/dev/add-ins/develop/automatically-open-a-task-pane-with-a-document

AndyHore commented 3 years ago

Hi,

Yes, we've tried it, and No, it doesn't work!

Andy.

From: Lillian Liu @.> Sent: Wednesday, March 24, 2021 3:25 PM To: OfficeDev/office-js @.> Cc: Andrew Hore @.>; Comment @.> Subject: Re: [OfficeDev/office-js] Word: Addin is not auto-loading in Word Online with custom WOPI host (#422)

This looks like an issue with custom WOPI hosts, so looping in @keyur32https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkeyur32&data=04%7C01%7Cahore%40uplandsoftware.com%7C5355d3362e014648da6a08d8eefa8c0d%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637522107148596990%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PI4BfHn28mhOIC6SNS8lClI1i22FUr1vA3hzavlEtSw%3D&reserved=0

@stowellthttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fstowellt&data=04%7C01%7Cahore%40uplandsoftware.com%7C5355d3362e014648da6a08d8eefa8c0d%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637522107148606945%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KMVf6b49zJSdsCHaYCUwWFjBdfBMXIYhqvpan%2ByaeFw%3D&reserved=0 - have you tried the auto-open taskpane feature? You need to tag the document, and the pane should automatically open. Thinking it might suffice as a workaround. https://docs.microsoft.com/en-us/office/dev/add-ins/develop/automatically-open-a-task-pane-with-a-documenthttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Fdev%2Fadd-ins%2Fdevelop%2Fautomatically-open-a-task-pane-with-a-document&data=04%7C01%7Cahore%40uplandsoftware.com%7C5355d3362e014648da6a08d8eefa8c0d%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637522107148616905%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Cw8npNgtkPW28W7ox%2FKcRvNNo1xnIIhfLxh2HlfU9VY%3D&reserved=0

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOfficeDev%2Foffice-js%2Fissues%2F422%23issuecomment-806092421&data=04%7C01%7Cahore%40uplandsoftware.com%7C5355d3362e014648da6a08d8eefa8c0d%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637522107148616905%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2FVSdUUiWAsx8IbXHoYLhYRD%2FzYy6cdP0KDE7FkyFAXc%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATGMREW2RNBNWV3H2NDRVS3TFI4BRANCNFSM4G5V7GKQ&data=04%7C01%7Cahore%40uplandsoftware.com%7C5355d3362e014648da6a08d8eefa8c0d%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637522107148616905%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0wOd%2BUJ%2BVl6aHvJ4NZ7bdK3isEb14yuNgFVX5U7IJbI%3D&reserved=0.

keyur32 commented 3 years ago

Hi there, this issue was investigated and is confirmed that this capability doesn't work for custom WOPI hosts, but only works for OneDrive enabled add-ins. We are investigating and this is in the backlog.

As a workaround, as the issue appears to be scoped to add-ins with add-in commands, you can try to have taskpane only add-ins (these were the 2013 style add-ins that do not contain a TaskPane overrides element). Those should work when embedded and auto load.

AndyHore commented 3 years ago

Hi Our add-in is a taskpane only and we've tried forcing it to auto-load and it didn't work. We can try again, but not sure this is going to work for us.

keyur32 commented 3 years ago

Interesting. We've seen some from others this does work.

A few more questions:

If you have Excel, can you try embedding this: WA104379190 (XLMiner Analysis Toolpak) add-in. I also forget but you may need to also either Upper Case or Lower case "WA" in the asset id.

AndyHore commented 3 years ago

It's in the App Store - search for "Qvidian" and you should find it. It works in Word and Excel.

Do you have a sample Excel file with that already embedded? If you send it to me, we can rule out how we've added it and just launch that from our WOPI interface to make sure it's working or not. Then I can compare with what we did to see what the difference may be.

OanaCorinaFilip commented 3 years ago

Hello,

I've experienced the same issue. It only happens on offline Word (Office 365 works fine). The Auto-Open feature works on documents created by the user opening the document, however, if a different user opens the document, the Auto-Open feature doesn't work.

My suspicion is that it has to do with how this setting is saved in the OOXML of the desktop document (which is different from the OOXML of documents created in online Word). Also if you get the base64 encrypted OOXML of a document created online and you try to create a new document in desktop Word using it, the operation will fail, since the two have different formats. It works the other way around though.

Could you please look into the Auto-Open issue? It makes the feature unusable in offline Word and really goes against the idea of cross-platmform Add-Ins.

mmoloney9966 commented 3 years ago

We've used the OpenXML SDK to add the webextensions and taskpane parts to the DOCX. All Word platforms (local desktop install, WebDAV integration, Office365.com) are able to open the modified DOCX but if issued to WOPI, Office Online just shows a "trouble opening document" message. The browser console does show the following exception....

WordEditorDS.js:2444 Uncaught (in promise) TypeError: Cannot read property 'ic' of null at f.M_e (WordEditorDS.js:2444) at f.get value [as value] (WordEditorDS.js:2825) at cm.OYf (WordEditorDS.js:4687) at ue.LIh (WordEditorDS.js:1950) at WordEditorDS.box4.dll1.js:7299 at new Promise () at TG.oNl (WordEditorDS.box4.dll1.js:7299) at new TG (WordEditorDS.box4.dll1.js:7299) at l.Fna (WordEditorDS.box4.dll1.js:7307) at l.createInstance (WordEditorDS.js:686)

Has anyone successfully modified DOCX with the webextensions and taskpane parts (per https://docs.microsoft.com/en-us/office/dev/add-ins/develop/automatically-open-a-task-pane-with-a-document) and launched a WOPI integration Office Online edit session ??

Attached is the OpenXML modified docx file. Test Document.ModifiedWithOpenXML.docx

keyur32 commented 3 years ago

Hi there,

Thanks for the additional details. I think we're missing an update to the automatically open a taskpane with a document article as we have a new attribute, you'll want to set storeType="wopicatalog" (all lower case), as specified in the file format reference article: https://docs.microsoft.com/en-us/openspecs/office_standards/ms-owexml/d4081e0b-5711-45de-b708-1dfa1b943ad1.

Can you try tagging the document with that attribute instead of using the 'omex' provider?

keyur32 commented 3 years ago

Note: for the documentation issue, filed https://github.com/OfficeDev/office-js-docs-pr/issues/2909 to update the article.

mmoloney9966 commented 3 years ago

WIll try this ASAP. Quick question first, do the other attribute values (e.g.: app ID, store, etc...) need to be lowercase?

keyur32 commented 3 years ago

thanks. Good question.

Here's an example: image

The asset id for your add-in should start an upper case "WA" string, I believe. This is the code for you add-in you can get from app source (navigate to the listing on app source and you will see the asset id in the URL).

mmoloney9966 commented 3 years ago

Still failing with the error message in the iframe "Sorry, there was a problem.....". Still seeing console error:

Uncaught (in promise) TypeError: Cannot read property 'jc' of null at f.mXe (WordEditorDS.js:2444) at f.get value [as value] (WordEditorDS.js:2826) at Hl.jUf (WordEditorDS.js:4691) at df.yCh (WordEditorDS.js:1950) at WordEditorDS.box4.dll1.js:7125 at new Promise () at UG.dFl (WordEditorDS.box4.dll1.js:7125) at new UG (WordEditorDS.box4.dll1.js:7125) at l.Sma (WordEditorDS.box4.dll1.js:7133) at l.createInstance (WordEditorDS.js:687)

Attached is the file that shows the change to "storeType="wopicatalog" but I've attached an image of the XML for the webextensions from the docx. I used the https://github.com/OfficeDev/Office-OOXML-EmbedAddin as the model for the OpenXML SDK implementation.

We have not yet modified our WebAddIn manifest with the yet as shown below. MUST that be done as well or should WOPI/OfficeOnline at least be able to open the edit session and just not open/load the task pane? Would not having our addin manifest modified cause this console exception?

Office.AutoShowTaskpaneWithDocument

image webaddin.docx

keyur32 commented 3 years ago

Ah, did you also follow these instructions here (sorry, thought I had posted that earlier in the thread but wasn't clear): https://wopi.readthedocs.io/en/latest/scenarios/hostinstalladdins.html

To enable this embedding you will need to register your staging and production environment domains first to allow add-ins to run in your host, and also send the same add-in ids as part of your post message as described in the FAQ of the link above.

Once you've done that, then, the add-ins should start a load.

mmoloney9966 commented 3 years ago

I did implement those changes as well for the additional form parameter "host_install_addins". I even still have the fiddler script change in to ensure the host_install_addins is being sent.

I am unsure who to ask or how to confirm that our environment domains are "registered" for this purpose. We have our addin officially in the Microsoft store. We have our WOPI host domains whitelisted by WOPI Office Online servers. Does that cover it OR is there another "registration" necessary and who do I contact for that? CSPP claims if we have our addin up in the Microsoft store, we are good but I am suspicious there is still something outstanding but not sure who I can reach out to in order to be sure. Do you have any contact info for someone I could reach out to?

As I mentioned, we have not yet modified our addin's manifest with the "TaskPanelId" change. Is that also required for this to work?

keyur32 commented 3 years ago

I think you'll first need to do an additional registration to have add-ins run in be auto installed in your host. Please contact csppteam@microsoft.com to get the process started.

mmoloney9966 commented 3 years ago

I will try them again. They didn't seem very aware when I asked this same question 3 weeks or longer ago.

Does our addin manifest need the "TaskPaneId" change as well for this to work?

mmoloney9966 commented 3 years ago

**Keyur,

Here is the response I got from CSPP. Wanted to get your opinion on what they are stating before we go off and try to implement this trusted window/frame layer....**

WOPI hosts must now communicate to M365 applications that they are embedded in a trusted page. When the M365 app has validated that the add-in is running in a trusted page environment, the app will activate the add-in.

To perform the validation, you must make the following updates to your host:

  1. Include a query string: &sftc=1 to url of POST request sent to the M365 server url, to indicate to the Office app that the Hosts support frame trust post Message.

IMPORTANT NOTE: sftc, is short for supportsFrameTrustedPostMessage)

  1. The host page needs to reply to the message App_IsFrameTrusted sent by the M365 app page with the message Host_IsFrameTrusted specified in the WOPI documentation.

IMPORTANT NOTE: The naming convention of post Message, App_xxxx, is the message sent from the M365 app to the host; Host_xxxx is the message send from Host.

For more information, please see the WOPI help documentation. @Sean Laberee should be able to assist you with any detailed questions beyond these resources.

Let us know when you have completed this update and we can implement your add-in to our whitelist.

mmoloney9966 commented 3 years ago

Keyur,

Not sure you saw this question in all our threads.

Does our addin manifest also need to be modified so that within the "Action" element for "ShowTaskpane", the "TaskpaneId" attribute is set to "Office.AutoShowTaskpaneWithDocument" ?

mmoloney9966 commented 2 years ago

Been a long time but I have what I hope is a simple question for you regarding this "hostInstallAddIns" mechanism....

Some of our customers use a central "admin-managed" location for webaddins instead of the Microsoft Store. Will the "hostInstallAddIns" mechanism work for webaddin locations other than the Microsoft Store?

Thanks in advance for any insight/help.

From: Keyur Patel - MSFT @.> Sent: Monday, August 30, 2021 12:10 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Comment @.> Subject: Re: [OfficeDev/office-js] Word: Addin is not auto-loading in Word Online with custom WOPI host (#422)

Ah, did you also follow these instructions here (sorry, thought I had posted that earlier in the thread but wasn't clear): https://wopi.readthedocs.io/en/latest/scenarios/hostinstalladdins.htmlhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwopi.readthedocs.io%2Fen%2Flatest%2Fscenarios%2Fhostinstalladdins.html&data=04%7C01%7Cmmoloney%40uplandsoftware.com%7Ca0194d59955c4338c50908d96bd09abb%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637659365958895384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Uxj4DMB3W0c%2F721e9Qlxpq2r8xxj7cLI3O3e3iITDLQ%3D&reserved=0

To enable this embedding you will need to register your staging and production environment domains first to allow add-ins to run in your host, and also send the same add-in ids as part of your post message as described in the FAQ of the link above.

Once you've done that, then, the add-ins should start a load.

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOfficeDev%2Foffice-js%2Fissues%2F422%23issuecomment-908472791&data=04%7C01%7Cmmoloney%40uplandsoftware.com%7Ca0194d59955c4338c50908d96bd09abb%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637659365958895384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KZgEWkxYkDk1UmG%2F2Xy28TEXKmu4Z%2F1FcsM8v24oETk%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAU5LVHX3PQLKBXYHTRZOKMDT7OUNFANCNFSM4G5V7GKQ&data=04%7C01%7Cmmoloney%40uplandsoftware.com%7Ca0194d59955c4338c50908d96bd09abb%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637659365958905338%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XjNHsy9%2FuOx%2BnL7gl%2B1rzxKYlcaSND6HlDVdTv0Bwjc%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cmmoloney%40uplandsoftware.com%7Ca0194d59955c4338c50908d96bd09abb%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637659365958905338%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yojgVBFvTissh9b0WFaP%2B6uD8H7hyxnddiBCnXynGac%3D&reserved=0 or Androidhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cmmoloney%40uplandsoftware.com%7Ca0194d59955c4338c50908d96bd09abb%7Cdd02d1e4d2a8462892c81f4b5de6419b%7C0%7C0%7C637659365958915300%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DmP3beOeLQaoON%2FaFISsZ1ZNFjq5OI3%2B1kYvmbLeI4s%3D&reserved=0.

keyur32 commented 1 year ago

Apologies for the delay, but to your question I think you are in the right hands with the CSPP support as they will have the latest. My understanding was this needs to be hosted in the store if you wish to use the host install mechanism as part of the WOPI protocol, as well as potentially being in the CSPP (plus) program.

keyur32 commented 1 year ago

Closing above out but please reopen / log a new issue if you have a WOPI question that is still not resolved. thanks.