【问题标题】:outlook 365 add-in: Office.context is always emptyOutlook 365 加载项:Office.context 始终为空
【发布时间】:2017-06-27 15:53:20
【问题描述】:

我正在为 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

【问题讨论】:

    标签: outlook office365 outlook-addin


    【解决方案1】:

    试着举一些工作的例子,例如: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 **
    
    
    });
    }; })();
    

    我试了一下,它对我有用.. 祝你好运。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多