【发布时间】:2022-10-23 18:20:07
【问题描述】:
我们有一个客户端要求在发送带有某些 Microsoft 信息保护/Azure 信息保护 (MSIP/AIP) 标签的电子邮件时执行操作。我们有一个桌面 Outlook 插件可以完美地做到这一点。
然而,现在客户正在请求相同的加载项,但使用的是新的现代风格 Outlook 加载项。我们创建了一个 on-send 加载项来完成此操作,但我们无法访问 Office.ComposeMessage 中的任何 Internet 标头。事实上,我们无法返回任何标题。
这是我们的代码:
async function fetchInternetHeaders(mailItem: Office.MessageCompose,
tags: string[]): Promise<string[]> {
return new Promise(function(resolve, reject) {
try {
let myTags: string[] = [
"msip_labels", // This is the value we need
"x-ms-has-attach", // This is for testing
"PR_SUBJECT_W", // This is for testing
"http://schemas.microsoft.com/mapi/proptag/0x0037001F", // test
"http://schemas.microsoft.com/mapi/proptag/0x5D07001F", // test
"http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/msip_labels/0x0000001F", // Another way to get msip_labels
];
mailItem.internetHeaders.getAsync(myTags, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
debug.Log("onSend.fetchInternetHeaders", "Selected headers: " + JSON.stringify(asyncResult.value));
} else {
debug.Log(
"onSend.fetchInternetHeaders",
"Error getting selected headers: " + JSON.stringify(asyncResult.error)
);
}
resolve(["FetchedInternetHeaders"]);
});
} catch (error) {
debug.Log("onSend.fetchInternetHeaders", "Error occurred", error);
reject(error);
}
});
注意:我们忽略了参数“tags”以使一切尽可能简单。
调用成功,但返回的数组始终为空,即使对于电子邮件主题等简单属性也是如此。我们做错了什么?
【问题讨论】:
-
发送消息时真的没有办法访问互联网标头吗?这对我们来说是一个严重的问题......有人可以提出另一种方法来做同样的事情吗?如果我们强制保存到 Drafts 文件夹并使用 Graph 来读取标题?
标签: outlook office-js outlook-addin office-addins outlook-web-addins