[英]Outlook AddIn GetAsync successful but returns nothing
I've got an Outlook Add In that was developed using the Office Javascript API. 我有一个使用Office Javascript API开发的Outlook加载项。 It looks at the new email being composed & does things based on who it's going to: https://docs.microsoft.com/en-us/office/dev/add-ins/reference/objectmodel/requirement-set-1.3/office.context.mailbox.item 它查看正在编写的新电子邮件,并根据要发送给谁的电子邮件进行处理: https : //docs.microsoft.com/zh-cn/office/dev/add/ins/reference/objectmodel/requirement-set-1.3/ office.context.mailbox.item
The code correctly returns the TO email when you 'select' the email from the suggested email list... screenshots shown @ bottom of this thread 当您从建议的电子邮件列表中“选择”电子邮件时,代码正确返回TO电子邮件...屏幕截图显示在该线程底部
To debug the Javascript, I use C:\\Windows\\SysWOW64\\F12\\IEChooser.exe 要调试Javascript,我使用C:\\ Windows \\ SysWOW64 \\ F12 \\ IEChooser.exe
It was working fine until last week. 到上周为止,一切都很好。 Is it possible a Windows update broke functionality? Windows更新是否可能破坏了功能?
var resultObjects;
var resultObjects2;
var strMessages = '';
var strTo = '';
var mailbox;
var mailitem;
(function () {
"use strict";
// The Office initialize function must be run each time a new page is loaded.
Office.initialize = function (reason) {
$(document).ready(function () {
mailbox = Office.context.mailbox;
mailitem = mailbox.item;
mailitem.to.getAsync(function (result) {
if (result.status === 'failed') {
strMessages = 'FAILED';
} else {
strMessages = 'SUCCESS';
strTo = result.value[0];
resultObjects = result;
resultObjects2 = result.value;
}
});
loadApp();
});
};
})();
Here are the values of the variables, when the app is loaded & debugger is not running 这是在加载应用程序且调试器未运行时的变量值
EDIT 编辑
If you 'select' the TO email so that it is bolded... the code works correctly. 如果您“选择”收件人电子邮件,使其以粗体显示,则代码可以正常工作。 If you leave the typed-in-text field without selecting the suggested email, it does not work. 如果您在没有选择建议的电子邮件的情况下保留了“键入文本”字段,则它将不起作用。 The same behavior is true for both the Outlook Web Application (@ https://outlook.office.com ) and the desktop outlook application. Outlook Web Application(@ https://outlook.office.com )和桌面Outlook应用程序都具有相同的行为。
The Office.context.mailbox.item.to.getAsync API will only return resolved recipients. Office.context.mailbox.item.to.getAsync API将仅返回已解析的收件人。 If the TO email address is not resolved (as in the first screenshot titled "Does not Work"), then API will not return the email address until it is resolved (in both desktop and OWA). 如果未解析TO电子邮件地址(如标题为“不起作用”的第一个屏幕截图中所示),则API在解析完之前(在台式机和OWA中)都不会返回该电子邮件地址。
You can use the RecipientsChanged Event , to get newly resolved recipients after you have queried for to.getAsync. 查询to.getAsync之后,可以使用RecipientsChanged事件获取新解析的收件人。 This event would fire when a recipient is newly resolved. 新解决收件人时将触发此事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.