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
687 stars 94 forks source link

Powerpoint document.settings not persisting between desktop and online versions within an addin. #2299

Open theboyknowsclass opened 2 years ago

theboyknowsclass commented 2 years ago

Hi this could be similar to https://github.com/OfficeDev/office-js/issues/1585

We have an addin, where we save to the document settings using Office.context.document.settings.set (followed by Office.context.document.settings.saveAsync()).

This seems fine when persisting between sessions within Desktop, and within Online.

but if I save a document on the desktop, when I go to PowerPoint online the same Addin with the same manifest cannot read the value of the setting (returns null).

Saving online, and loading on the desktop works fine, however.

I tried to replicate this in a gist and Script Lab, but it works (even when saving exactly the same key/value as we would in our Addin), so i don't know if there's some Addin-specific path it's going through that's causing the issue)

chiz-ms commented 2 years ago

Hi @theboyknowsclass, thanks for reporting this issue. Do you have a pptx file that could consistently repro this issue? It would be helpful if you could share a test file containing such saved settings (but no sensitive data) to help us investigate this issue.

theboyknowsclass commented 2 years ago

hi @chiz-ms thanks for the quick response.

Here is a file created in our add-in in ppt desktop -> Shoe Presentation - Saved in Desktop.pptx

The metadata is readable only in the Desktop Add-in

This is a file created in the same add-in in ppt online -> Shoe Presentation - Saved Online.pptx

The metadata is readable in both the Desktop Add-in and online

theboyknowsclass commented 2 years ago

looking at the webextension1.xml in the .zip, could it be that the powerpoint online is checking for more than the just the 'id' and is also looking at 'store' and 'storeType'?

gingerjia commented 2 years ago

Hi @theboyknowsclass, seems you are already get the root cause :). Yes, if the storeType isn't same, we considered it as different add-in, so cannot reading the setting value from each other. This is by design for security consideration. Another thing may need your help to confirm is when you repro the scenario, the detail steps are like below?

  1. inserted Add-ins at Desktop and save settings,
  2. upload the file to online,
  3. and insert add-ins again from online,
  4. then try to read the setting value If yes, the step 1&3 are the reason that the two add-in store type are different.

And if you do the same step from online to desktop, I think the issue should also happen:

  1. inserted Add-ins at Online and save settings,
  2. download the file to local,
  3. and insert add-ins again from Desktop,
  4. then try to read the setting value

Looking forward to your confirm about the steps. And if have any concern, please let us know. Thanks!

theboyknowsclass commented 2 years ago

Thanks @gingerjia The issue is that that is not how excel or word behave - metadata seems to be readable regardless of store type

Also a file created in ppt online can be read fine by ppt desktop even though the store types etc are different.

gingerjia commented 2 years ago

Hi @theboyknowsclass I tried at Excel side, it does works even store type not same. But for a file created in ppt online and then open in desktop to read, this doesn't work for me. For ppt app, no matter from online to desktop, or from desktop to online, both not work due to store type not same. I will compare the logic with Excel side and update to you when have progress.

For your point "Also a file created in ppt online can be read fine by ppt desktop even though the store types etc are different.", can you share detail steps to help repro at my side? Since my side cannot read success from online to desktop also. :( Thanks!

theboyknowsclass commented 2 years ago

just for moire detail this is my desktop version -> Microsoft® PowerPoint® for Microsoft 365 MSO (Version 2110 Build 16.0.14527.20270) 64-bit

But the steps are as follows:

Load powerpoint online Upload your addin Save Metadata to the document and save the document (we're saving to onedrive)

Load powerpoint desktop Open the document we just saved from onedrive Load the addin (from a trusted network share)

In this case i can see the metadata. just not the other way around.

and that for me is the expected performance - as we need to ensure this works for our clients in a production setting (though i assume in that case the store etc should be the same

gingerjia commented 2 years ago

@theboyknowsclass thanks very much for the detail info. It's very helpful and I do repro now. I will go on following up the issue and back to you when have result. Thanks!

chiz-ms commented 2 years ago

The issue is confirmed and tracked as ADO#5663545 in our backlog.

andreagasparin commented 1 year ago

Hi @dingjin-ms @chiz-ms @gingerjia, I'm also experiencing this issue. Is there any update on this? Thanks

JHJ-MS commented 1 year ago

Hi @andreagasparin , it is still in our backlog we'll update here if it has any updates. Thanks.