1

If I have my desktop running an O365 office app in Excel(desktop version), when I open another instance of Excel(desktop version), is it possible for the same app in both instances to share some session information?

I had a look here https://github.com/OfficeDev/Excel-Add-in-JavaScript-PersistCustomSettings and thought that browser cache might work but looks like it doesn't.

My scenario for the above is:

1) Open Excel(desktop version).

2) Run my Excel app.

3) Perform a login.

4) Persist login information.

5) Open another Excel workbook(desktop version) which contains some saved data published by my Excel app previously.

6) Run my Excel app.

7) I would not want to login again since I have already logged in, in step 3.

So, where can I persist the login information so that regardless of Office desktop or Office on browser, I can reuse the login info?

Thanks in advance!

wm_
  • 269
  • 2
  • 4
  • 10

1 Answers1

1

It depends on what you mean by sharing the same session information, and also if you're talking about simultaneously-open documents or not.

Excel Online does not currently support co-authoring with Excel Desktop (not at an API level, but at the fundamental user-interface level). So for simultaneously-open documents, it's not possible yet (unless you use the web browser's local storage, but that implies that you're on the same computer for both Desktop and Excel Online... which doesn't make much sense). If you need to store information across sessions, though, storing information in the document's application settings would work (Office.context.document.settings)

UPDATE:

Based on updated question, window.localStorage should absolutely work for you (provided the browser you're talking about is Internet Explorer -- which is what is used by the Office Add-in on the desktop). I have done it myself, and the setting is persisted both across multiple launches of the Desktop, and across using the site on Internet Explorer.

Hope this helps!

~ Michael Zlatkovsky, developer on Office Extensibility team, MSFT

  • I tried the localStorage example from https://github.com/OfficeDev/Excel-Add-in-JavaScript-PersistCustomSettings and that did not seem to work across two Excel desktop instances. In the example, it refers to localStorage as "Browser long-term storage. Am I missing something? – wm_ Jun 20 '16 at 06:14
  • Looks like it was because my first instance of Excel was running in debug mode from VS as I need to run it through VS for the add-in to be there. So, if I have 3 instances of Excel desktop running (1st from VS in debug mode, 2nd and 3rd from running by executing the executable, I can share the localStorage info between the 2nd and 3rd instances but not the 1st.). Is the localStorage a secure place to save sensitive information such as user credentials/passwords? Thanks for your help! – wm_ Jun 20 '16 at 06:45
  • Regarding security, see http://stackoverflow.com/questions/17280390/can-local-storage-ever-be-considered-secure – Michael Zlatkovsky - Microsoft Jun 20 '16 at 15:42