javascript - Outlook 加载项 -> 上下文加载项清单
问题描述
我正在尝试创建一个在每封电子邮件中激活的 Outlook 加载项。我想知道是否有办法调用这样的函数执行。我只需要在用户查看电子邮件后立即访问电子邮件文本。用于使用 AI 进行欺诈检测。
我发现了这个微软的清单:
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
xsi:type="MailApp">
<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>351bf5d8-c3e5-4c35-8f0b-3da9a28f22f2</Id>
<!-- Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.0</Version>
<ProviderName>Outlook Dev Center</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="Contoso Order Number Add-in" />
<Description DefaultValue="A sample add-in that demonstrates contextual activation on a Regex match."/>
<!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
<IconUrl DefaultValue="https://127.0.0.1:8080/assets/icon-32.png" />
<HighResolutionIconUrl DefaultValue="https://127.0.0.1:8080/assets/hi-res-icon.png"/>
<!-- End Basic Settings. -->
<!-- Legacy settings -->
<!-- These values will be used for legacy clients that do not understand the -->
<!-- VersionOverrides schema. These values will be ignored by clients that do -->
<!-- understand VersionOverrides, with the exception of Permissions -->
<Hosts>
<Host Name="Mailbox" />
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.1" />
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://127.0.0.1:8080/index.html"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteItem</Permissions>
<!-- Note that this Rule element matches the Rule element inside the -->
<!-- DetectedEntity element below. This is so that older clients will be able -->
<!-- to activate the add-in on the same context. -->
<Rule xsi:type="RuleCollection" Mode="And">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
<Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="9Digits" RegExValue="\d{9}" PropertyName="BodyAsPlaintext"/>
</Rule>
<DisableEntityHighlighting>false</DisableEntityHighlighting>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<!-- VersionOverrides for the v1.1 schema -->
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.5">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<!-- DetectedEntity -->
<ExtensionPoint xsi:type="DetectedEntity">
<Label resid="contextLabel" />
<SourceLocation resid="detectedEntityURL" />
<Rule xsi:type="RuleCollection" Mode="And">
<Rule xsi:type="ItemIs" ItemType="Message" />
<Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="OrderNumber" RegExValue="CO-\d{9}" PropertyName="BodyAsPlaintext"/>
</Rule>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://127.0.0.1:8080/assets/icon-16.png"/>
<bt:Image id="icon32" DefaultValue="https://127.0.0.1:8080/assets/icon-32.png"/>
<bt:Image id="icon80" DefaultValue="https://127.0.0.1:8080/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="detectedEntityURL" DefaultValue="https://127.0.0.1:8080/index.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="contextLabel" DefaultValue="Order Number Detected"/>
</bt:ShortStrings>
</Resources>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>
问题仅在于使用正则表达式激活。
解决方案
Compose 插件可以根据需求集 1.10 中的某些事件自动运行,但 Read 插件没有类似的功能。
上下文加载项仍需要用户交互才能启动加载项。
用户可以固定任务窗格加载项,它会自动启动,但这需要用户执行操作,并且加载项始终可见。
对于您描述的部分场景,您希望获取电子邮件的文本。这可以通过使用Microsoft Graph 中的更改通知的后端服务实现,该服务可以在用户收到电子邮件时通知服务。但是,这会在每条消息上触发,而不仅仅是用户阅读的消息。
推荐阅读
- php - 如何使用 TCPDF 在 pdf 页面中显示图像?
- c# - asp.net 核心 2.0 - ApplicationUser.cs
- c# - WPF/C# MaterialDesignInXAML,如何将内容绑定到 controlTemplate 中的字符串
- javascript - aframe-extra 3.8.6 版鼠标单击光标消失问题
- dynamics-crm - CRM Package deployer Tool - 将文件作为附件导入
- nstimer - 如何在没有计时器变量的情况下调用 scheduleTimerWithTimeInterval
- c# - Firebase 分析 DllNotFoundException
- php - 如何在框下方显示时间和日期,例如 facebook 或 worpress 帖子?
- android - 在 Android 中的新意图之前添加动画并删除库存动画
- php - 更新 wordpress 字段“日期”