漫游设置在Office.js中无法正常工作 [英] Roaming Setting not working properly in Office.js
问题描述
我看到漫游设置有些奇怪的行为。我可以在内存中设置漫游设置,注意它已成功更改。然后我导航到其他页面,我在那里获得更新设置,这是我的应用程序的
根URL。但是当我再次从Ribbon Button重新加载加载项时,它会加载我的根URL并显示漫游设置的OLD值。类似地,当我重新启动我的Outlook应用程序并从功能区按钮加载加载项时,它会加载我的根URL并且
显示我的新值(我实际上想要的是不重新启动Outlook应用程序)。
am seeing some odd behavior with roaming settings. I can set a roaming setting in memory, notice it changed successfully. Then i navigate to other page, i get updated setting there and that is root url of my application. But when i reload add-in from Ribbon Button again, it loads my root url and it shows me OLD value of roaming setting. Similarly when i restart my Outlook application and load add-in from Ribbon Button, it loads my root url and it shows me NEW value(Which i actually want without restarting outlook application).
如何在不重新启动Outlook桌面客户端的情况下获取漫游设置的新值?
How can i get NEW value of Roaming setting without restart my Outlook desktop client again?
在MyPage上:
window.office.context.roamingSettings.set("ABC","NewValue");
window.office.context.roamingSettings.saveAsync();
this.props.router.push("/");
On RootURL:
On RootURL:
var tempVar = window.office.context.roamingSettings.get("ABC");
推荐答案
你不要不需要重新启动Outlook或加载项以从"漫游设置"获取更新值确实是对象。以下是否可以解决您的问题?
You don't need to restart Outlook or add-in to get updated value from "roamingSettings" object, indeed. Is the following would solve your issue?
window.office.context.roamingSettings.set("ABC","NewValue");
window.office.context.roamingSettings.saveAsync( function (asyncResult) {
if (asyncResult.error) {
// well, work with the error? asyncResult.error.message
} else {
this.props.router.push("/");
}
});
告诉我,
Let me know,
这篇关于漫游设置在Office.js中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!