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
690 stars 95 forks source link

[Word online] Unable to read contentControls and other properties after a simple redirection #4875

Open quefournier opened 2 months ago

quefournier commented 2 months ago

Since the end of July, we have encountered an issue with our add-in (SharePoint manifest) when reading contentControls (as well as other properties) in Word documents. The scenario is as follows: we have a simple HTML login page that redirects (once the user is logged in) to the index page of our add-in. In cases where the document already contains the add-in information (i.e., on an existing document where the add-in was inserted), after being redirected from the login page, we are unable to access the properties of our document. Once these properties are loaded with .load(), the call to context.sync() will either never resolve correctly or cause a crash of the pane containing the add-in.

Your Environment

Current behavior

When opening a Word document, if it already contains the information from our SharePoint add-in, we are unable to read the contentControls of the document after being redirected from our login page. Note: To reproduce this bug correctly, the manifest must be available on SharePoint. Inserting a manifest from a local file will not allow this bug to be reproduced.

Steps to reproduce

  1. Create a new document and insert the app using the manifest from sharepoint
  2. Click the connect button
  3. You are redirected to the add-in main page. The document's contentControls should be logged in the console after being read correctly
  4. Refresh the window or tab where your Word document is located (f5)
  5. Click the connect button again
  6. After being redirected to the add-in main page for the second time the context.sync() call will either not resolve or the add-in page will crash

Link to live example(s)

We cannot reproduce the issue in Script Lab because it involves a redirection and, presumably, a SharePoint manifest.

You can use the attached files and set it up like this:

  1. Use a manifest hosted on Sharepoint and make it's sourceLocation points to the following page : (in attachements) connectionPage.html
  2. Make the above mentionned document.location.href = "" points to the following page: (in attachements) al-addin.html. The code in this scenario was shrunk to the extreme.

Context

Our clients can no longer use our 'template documents' (empty documents that already contain the information from our SharePoint add-in) and import and manage data through our add-in.

Useful logs

On screenshot 1. the addin is inserted and the contentControls are loaded and display correctly in the console. On screenshot 2. the page was reloaded, and after loading our contentControls the add-in crash at the context.sync() command. You can check the code on the attached html pages

shanshanzheng-dev commented 2 months ago

Hi @quefournier Thanks for reporting this issue. About sharePoint manifest, do you mean this? https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/explore-the-app-manifest-structure-and-the-package-of-a-sharepoint-add-in If yes, The SharePoint Add-In model in SharePoint Online has been deprecated as of November 27th 2023, checkout thefull retirement announcement to learn more. Thanks

quefournier commented 2 months ago

Well not quite. I'm not taking about a Sharepoint add-in but an Office add-in manifest file that is "Sharepoint hosted" (stored on our Sharepoint appcatalog).

shanshanzheng-dev commented 2 months ago

@quefournier We'll take a look and report back if we have a suggestion for you. Thanks.

xiruatms commented 2 days ago

@quefournier , will you please share the manifest file you used to repro this?

quefournier commented 2 days ago

@xiruatms sure ! There it is : LoopConnector_testenv001 (1).xml.zip I'd be happy to show it directly in a live demo if needed 👍

xiruatms commented 2 days ago

It seems I was not authorized to access the pages.

image

If you would like to follow up with us and provide more details (your contact information, testing accounts and so on), please use this form to submit your information: https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR9NvrlmrippKsMvh4kTM325URVZMWjYyQTVOTVNLTUo5VzFRTTcyNU1RSy4u

quefournier commented 2 days ago

@xiruatms I'll send the infos (test account infos + full scenario) within the hour

quefournier commented 2 days ago

@xiruatms I sent the account infos through your form. Is there a way to privately communicate the scenario (which includes screen captures and links of our app) ? Thanks.

xiruatms commented 1 day ago

Anything wrong with the testing environment? image

quefournier commented 1 day ago

Sorry for not anticipating this. We're based in France and some services are turned off during the night. Would it be possible for you to test it between 5AM and 10PM UTC ?