outlook 365 加载项:Office.context 始终为空
outlook 365 add-in: Office.context is always empty
我正在为 outlook 365 开发一个简单的插件,但看起来我遗漏了一些简单的要点,因为 office.context 变量对我来说总是空的,例如甚至基本代码示例:
// The initialize function is required for all apps.
Office.initialize = function () {
// Checks for the DOM to load using the jQuery ready function.
$(document).ready(function () {
// After the DOM is loaded, app-specific code can run.
var item = Office.context.mailbox.item;
var subject = item.subject;
// Continue with processing the subject of the current item,
// which can be a message or appointment.
});
}
我能错过什么?加载项权限最高 -- ReadWriteMailbox
尝试举一些工作的例子,例如:https://github.com/OfficeDev/Outlook-Add-in-Commands-Translator
您需要 home.html 和 home.js.
的部分内容
我认为这部分代码需要适用于您的情况:
(function () {
'use strict';
// The initialize function must be run each time a new page is loaded
Office.initialize = function (reason) {
$(document).ready(function () {
** now try to get the item **
});
}; })();
我试过了,它对我有用..
祝你好运。
我正在为 outlook 365 开发一个简单的插件,但看起来我遗漏了一些简单的要点,因为 office.context 变量对我来说总是空的,例如甚至基本代码示例:
// The initialize function is required for all apps.
Office.initialize = function () {
// Checks for the DOM to load using the jQuery ready function.
$(document).ready(function () {
// After the DOM is loaded, app-specific code can run.
var item = Office.context.mailbox.item;
var subject = item.subject;
// Continue with processing the subject of the current item,
// which can be a message or appointment.
});
}
我能错过什么?加载项权限最高 -- ReadWriteMailbox
尝试举一些工作的例子,例如:https://github.com/OfficeDev/Outlook-Add-in-Commands-Translator 您需要 home.html 和 home.js.
的部分内容我认为这部分代码需要适用于您的情况:
(function () {
'use strict';
// The initialize function must be run each time a new page is loaded
Office.initialize = function (reason) {
$(document).ready(function () {
** now try to get the item **
});
}; })();
我试过了,它对我有用.. 祝你好运。