新约会的Outlook Office上下文saveasync回调问题

Outlook Office context saveasync callback problem for new appointment

我创建了一个 outlook 插件,它在创建新约会页面中打开。我在这里打开新的约会页面并调用以下函数来同步内容约会 page.When 我第一次打开约会页面我没有从 saveasync 方法获得任何回调。这花了很多时间。如果我关闭并再次打开我的应用程序并执行相同的操作,那么我将收到回调。

Office.context.mailbox.subject.setAsync('subject');
Office.context.mailbox.body.setAsync('sample body');
Office.context.mailbox.item.saveAsync(
function callback(result) {
   // Process the result.
});

您应该嵌套调用,因为它们都是异步的。

Office.context.mailbox.subject.setAsync
(
    "subject",
    function (asyncResult0)
    {
        if (asyncResult0.status === Office.AsyncResultStatus.Succeeded)
        {
            Office.context.mailbox.body.setAsync
            (
                "sample body",
                function (asyncResult1)
                {
                    if (asyncResult1.status === Office.AsyncResultStatus.Succeeded)
                    {
                        Office.context.mailbox.item.saveAsync
                        (
                            function (result)
                            {
                                // Process the result
                            }
                        );
                    }
                }
            );
        }
    }
);