2

I am building an Office 365 Add-In for Outlook with the 365 javascript API. Can I use localStorage in the Outlook 2016 PC client like I can on the Outlook Web App? Or should I use RoamingSettings?

It's hard to discern from the docs: https://dev.office.com/docs/add-ins/develop/persisting-add-in-state-and-settings

missbarium
  • 131
  • 2
  • 11

1 Answers1

2

yes you can access LocalStorage in your add-in. Indeed, your add-in is a website and in the case of Outlook Desktop the underlying browser is IE. Take care of the case of Safari incognito mode where localStorage is disabled.

RoamingSettings and LocalStorage are different and should be used for different purposes. RoamingSettings is a "per mail account storage" provided by Office.js. LocalStorage is a "per website storage" provided by the browser, precisely, for a given browser and for the same domain you can access the values in LocalStorage.

For example, with RoamingSettings, for a given Microsoft mail account, you can reuse values between your add-in loaded in Office Desktop and in Outlook Online. Of course it can be used only in the context of an add-in.

An example of usage of LocalStorage would be, if you have a web application served with the same domain but which is not the add-in. Then, for the same browser, LocalStorage can be use to share things like token authentication etc.

Community
  • 1
  • 1
Benoit Patra
  • 4,355
  • 5
  • 30
  • 53