有没有办法查看是否安装了特定的加载项



有没有办法(API或其他?)来确定是否安装了加载项?

我正在考虑增加 Exchange 安装以插入我自己的按钮以告诉我的用户是否安装了 Outlook 加载项?

有没有用于查找的 API?

Office 对象模型具有可从 Outlook.Application 对象访问的 COMAddins 集合,可用于循环访问所有已注册的外接程序。 加载的任何外接程序都将 COMAddin.Connect 设置为 True(可以设置为 False 以卸载外接程序)。

https://msdn.microsoft.com/en-us/library/ff870066.aspx

在 Exchange 和 OWA(而不是桌面 Outlook)中执行此操作的诀窍是使用 JS 手动打开"加载项"窗格并尝试单击加载项。我意识到并不完美,但即使没有直接的 API 支持,它也确实满足了原始要求。

编辑名为 microsoft.owa.mail.compose 的文件.js并找到一个好位置来输入类似于以下内容的内容。

var workDocument = (this.bh.bz) ? $(this.bh.bz.document) : window.document;
var yourAddIn = $(workDocument).find('iframe[title="Your_Add-In_Name"]');
if (yourAddIn.length > 0) {
	yourAddIn[0].contentWindow.postMessage({ id: 'Look_for_your_id_using_DevTools_F12_and_Find_the_id', message: 'send'}, '*');
	return;
} else {
	// Click Add-in button, click the add-in name in the add-ins list
	var addInsButton = $(workDocument).find("button[title='Add-ins']");
	if (addInsButton.length <= 0) {
		return;
	}
	addInsButton[0].click();
                               
}

最新更新