Issue with Office.context.document.settings.get

匆匆过客 提交于 2019-12-01 14:58:22

This issue is a symptom of side-loading add-ins. A little background on this might help.

Certain add-in functionality, such as Settings, is keyed to a specific add-in. This allows you to ensure your settings don't get overwritten by another add-in that just happened to use the same setting name. When you retrieve your settings from Office, it is returning only those settings originally attributed to your add-in. This attribution is keyed off the add-in's ID from your manifest.

When an add-in is loaded from the Store or your tenant's add-in catalog, the add-in assigns the id for that add-in from your manifest file. Since this value doesn't change, it allows you to maintain settings across platforms and versions of your add-in.

Side-loading works differently. When you side-load an add-in, Office will assign it a randomly generated ID. This is done to ensure your development and production versions can co-exist side-by-side on the same machine. If Office used the ID from the manifest, it would effectively remove the production version of your add-in.

In most cases, the effects of side-loading will have no effect on your add-in. That is unless you're attempting to test Settings across machines/platforms where the automatically generated ID breaks the connection between your add-in and it's settings.

The workaround for this is to use a developer tenant and centrally publish your add-in there. This will automatically handle deployment of your add-in across each platform and ensure they all use the same ID value.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!