我有一个利用appendOnSendAsync函数的Outlook外接程序。
Office.context.mailbox.item.body.appendOnSendAsync(
"<img src='xxxx' />",
{
coercionType: Office.CoercionType.Html
},
function(asyncResult) {
console.log(asyncResult);
}
);在启用之前,我会检查一下下面的内容。
Office.context.requirements.isSetSupported('MailBox', '1.9')在outlook.com上测试它时,该特性的工作原理是相同的。然而,在我的Mac (16.66.2版)上,当我在outlook.com上发送一条消息时,该函数似乎不像它那样附加像素。
为了让它在我的Outlook客户端上工作,我还需要做些什么吗?
下面是我发起电话的方式。我没有引用下面的说明,因为它不是由工具栏中的任何按钮触发的。同样,这段代码可以在Outlook.com上工作,但是不能在Outlook.com上使用新的UI。
jQuery("#track_email_code").on("click", function(){
var pixel_code = jQuery("#track_email_code").val();
if(Query("#track_email_code").is(":checked")) {
appendText = '<img src="XXXXXXX'+pixel_code+'" />';
}
else {
appendText = '';
}
Office.context.mailbox.item.body.appendOnSendAsync(
appendText,
{
coercionType: Office.CoercionType.Html
},
function(asyncResult) {
console.log(asyncResult);
}
);
});这是我的清单文件
<?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"
xsi:type="MailApp">
<Id>xxxxxxxxxxx</Id>
<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>2.0.1.6</Version>
<ProviderName>xxxxxx</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="xxxxxx" />
<Description DefaultValue="xxxx"/>
<!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
<IconUrl DefaultValue="https://xxxxx/icon_64.png" />
<HighResolutionIconUrl DefaultValue="https://xxxxx/icon.png"/>
<!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
<SupportUrl DefaultValue="https://xxxxx.com" />
<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
<AppDomain>https://xxxxxx.com</AppDomain>
<AppDomain>https://o365.xxxxxx.com</AppDomain>
</AppDomains>
<!--End Basic Settings. -->
<Hosts>
<Host Name="Mailbox" />
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.1" />
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://xxxxxx/beta/index.html"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteMailbox</Permissions>
<Rule xsi:type="RuleCollection" Mode="Or">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
</Rule>
<DisableEntityHighlighting>false</DisableEntityHighlighting>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<Requirements>
<bt:Sets DefaultMinVersion="1.1">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
<FunctionFile resid="functionFile" />
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgReadMMGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="msgComposeAddContact">
<Label resid="addContactLabel"/>
<Supertip>
<Title resid="addContactTitle"/>
<Description resid="addContactDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="readEmailContactPaneUrl" />
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgComposeCmdGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="msgComposeInsertGist">
<Label resid="insertGistLabel"/>
<Supertip>
<Title resid="insertIconTitle"/>
<Description resid="insertGistDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="addActivityUrl" />
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
<OfficeTab id="TabDefault">
<Group id="apptAttendeeGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="apptAttendeeOpenPaneButton">
<Label resid="logActivityLabel"/>
<Supertip>
<Title resid="logActivityLabel"/>
<Description resid="logActivityDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="meetingContactPaneUrl"/>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgReadGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="msgReadOpenPaneButton">
<Label resid="logActivityLabel"/>
<Supertip>
<Title resid="logActivityLabel"/>
<Description resid="logActivityDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="meetingContactPaneUrl"/>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://xxxxxx/assets/mm_icon_16.png"/>
<bt:Image id="icon32" DefaultValue="https://xxxxxx/assets/mm_icon_32.png"/>
<bt:Image id="icon80" DefaultValue="https://xxxxxx/assets/mm_icon_80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="https://xxxxxx/beta/function-file/function-file.html"/>
<bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://xxxxxx/beta/index.html"/>
<bt:Url id="addActivityUrl" DefaultValue="https://xxxxxx/beta/msg-compose/activity.html"/>
<bt:Url id="readEmailContactPaneUrl" DefaultValue="https://xxxxxx/beta/contacts/index_mobile.html"/>
<bt:Url id="apptContactPaneUrl" DefaultValue="https://xxxxxx/beta/contacts/index_mobile.html"/>
<bt:Url id="meetingContactPaneUrl" DefaultValue="https://xxxxxx/beta/contacts/index_mobile.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="logMeetingLabel" DefaultValue="Log Meeting"></bt:String>
<bt:String id="logActivityLabel" DefaultValue="xxxxxxxxxxx Log Activity"></bt:String>
<bt:String id="groupLabel" DefaultValue="xxxxxxxxxxx"/>
<bt:String id="customTabLabel" DefaultValue="My Add-in Tab"/>
<bt:String id="paneReadButtonLabel" DefaultValue="Display all properties"/>
<bt:String id="paneReadSuperTipTitle" DefaultValue="Get all properties"/>
<bt:String id="addContactTitle" DefaultValue="Add Contacts to xxxxxxxxxxx"></bt:String>
<bt:String id="addContactLabel" DefaultValue="xxxxxxxxxxx"></bt:String>
<bt:String id="insertGistLabel" DefaultValue="Log Email"></bt:String>
<bt:String id="insertGistTitle" DefaultValue="Log Email"></bt:String>
<bt:String id="insertIconTitle" DefaultValue="Log Email"></bt:String>
<bt:String id="insertDefaultGistLabel" DefaultValue="Insert Default Gist"><bt:Override Locale="es-ES" Value="Inserte el Gist predeterminado"/></bt:String>
<bt:String id="insertDefaultGistTitle" DefaultValue="Insert Default Gist"><bt:Override Locale="es-ES" Value="Inserte el Gist predeterminado"/></bt:String>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="logActivityDesc" DefaultValue="Log activity to xxxxxxxxxxx"></bt:String>
<bt:String id="addContactDesc" DefaultValue="Add/Update Contacts"></bt:String>
<bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a pane displaying available properties. This is an example of a button that opens a task pane."/>
<bt:String id="insertGistDesc" DefaultValue="Allows you to log emails to your xxxxxxxxxxx Account.">
<bt:Override Locale="es-ES" Value="Muestra una lista de sus Gists y permite insertar su contenido en el mensaje actual"/>
</bt:String>
<bt:String id="insertDefaultGistDesc" DefaultValue="Inserts the contents of the Gist you mark as default into the current message">
<bt:Override Locale="es-ES" Value="Inserta el contenido de lo Gist que marca como predeterminado en el mensaje actual"/>
</bt:String>
</bt:LongStrings>
</Resources>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.1">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
<FunctionFile resid="functionFile" />
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgReadMMGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="msgComposeAddContact">
<Label resid="addContactLabel"/>
<Supertip>
<Title resid="addContactTitle"/>
<Description resid="addContactDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="readEmailContactPaneUrl" />
<SupportsPinning>true</SupportsPinning>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgComposeCmdGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="msgComposeInsertGist">
<Label resid="insertGistLabel"/>
<Supertip>
<Title resid="insertIconTitle"/>
<Description resid="insertGistDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="addActivityUrl" />
<SupportsPinning>true</SupportsPinning>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
<OfficeTab id="TabDefault">
<Group id="apptAttendeeGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="apptAttendeeOpenPaneButton">
<Label resid="logActivityLabel"/>
<Supertip>
<Title resid="logActivityLabel"/>
<Description resid="logActivityDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="meetingContactPaneUrl"/>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgReadGroup">
<Label resid="groupLabel"/>
<Control xsi:type="Button" id="msgReadOpenPaneButton">
<Label resid="logActivityLabel"/>
<Supertip>
<Title resid="logActivityLabel"/>
<Description resid="logActivityDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16"/>
<bt:Image size="32" resid="icon32"/>
<bt:Image size="80" resid="icon80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="meetingContactPaneUrl"/>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
</DesktopFormFactor>
<MobileFormFactor>
<FunctionFile resid="residUILessFunctionFileUrl" />
<ExtensionPoint xsi:type="MobileMessageReadCommandSurface">
<Group id="mobileMsgRead">
<Label resid="groupLabel" />
<Control xsi:type="MobileButton" id="mobileMessageRead">
<Label resid="addContactLabel"/>
<Icon xsi:type="bt:MobileIconList">
<bt:Image size="25" scale="1" resid="icon32" />
<bt:Image size="25" scale="2" resid="icon32" />
<bt:Image size="25" scale="3" resid="icon32" />
<bt:Image size="32" scale="1" resid="icon32" />
<bt:Image size="32" scale="2" resid="icon32" />
<bt:Image size="32" scale="3" resid="icon32" />
<bt:Image size="48" scale="1" resid="icon80" />
<bt:Image size="48" scale="2" resid="icon80" />
<bt:Image size="48" scale="3" resid="icon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="readEmailMobileContactPaneUrl" />
</Action>
</Control>
</Group>
</ExtensionPoint>
</MobileFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://xxxxxx/assets/mm_icon_16.png"/>
<bt:Image id="icon32" DefaultValue="https://xxxxxx/assets/mm_icon_32.png"/>
<bt:Image id="icon80" DefaultValue="https://xxxxxx/assets/mm_icon_80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="https://xxxxxx/beta/function-file/function-file.html"/>
<bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://xxxxxx/beta/index.html"/>
<bt:Url id="addActivityUrl" DefaultValue="https://xxxxxx/beta/msg-compose/activity.html"/>
<bt:Url id="readEmailContactPaneUrl" DefaultValue="https://xxxxxx/beta/contacts/index_mobile.html"/>
<bt:Url id="readEmailMobileContactPaneUrl" DefaultValue="https://xxxxxx/beta/contacts/index_mobile.html"/>
<bt:Url id="meetingContactPaneUrl" DefaultValue="https://xxxxxx/beta/contacts/index_mobile.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="logMeetingLabel" DefaultValue="Log Meeting"></bt:String>
<bt:String id="logActivityLabel" DefaultValue="xxxxxxxxxxx Log Activity"></bt:String>
<bt:String id="addContactTitle" DefaultValue="Add Contacts to xxxxxxxxxxx"></bt:String>
<bt:String id="addContactLabel" DefaultValue="xxxxxxxxxxx"></bt:String>
<bt:String id="groupLabel" DefaultValue="xxxxxxxxxxx"/>
<bt:String id="customTabLabel" DefaultValue="My Add-in Tab"/>
<bt:String id="paneReadButtonLabel" DefaultValue="Display all properties"/>
<bt:String id="paneReadSuperTipTitle" DefaultValue="Get all properties"/>
<bt:String id="insertGistLabel" DefaultValue="Log Email"></bt:String>
<bt:String id="insertGistTitle" DefaultValue="Log Email"></bt:String>
<bt:String id="insertIconTitle" DefaultValue="Log Email"></bt:String>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="logActivityDesc" DefaultValue="Log activity to xxxxxxxxxxx"></bt:String>
<bt:String id="addContactDesc" DefaultValue="Add/Update Contacts"></bt:String>
<bt:String id="paneReadSuperTipDescription" DefaultValue="Log Email"/>
<bt:String id="insertGistDesc" DefaultValue="Allows you to log emails to your xxxxxxxxxxx Account." />
<bt:String id="insertDefaultGistDesc" DefaultValue="Log Email" />
</bt:LongStrings>
</Resources>
<ExtendedPermissions>
<ExtendedPermission>AppendOnSend</ExtendedPermission>
</ExtendedPermissions>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>发布于 2022-11-12 10:27:07
Mac上的经典UI不支持邮箱要求集1.9。有关详细信息,请参阅Outlook JavaScript API需求集。
确保您做了在Outlook外接程序中实现附加发送页面中描述的所有事情。例如,指南的最后一点建议以下列方式注册事件处理程序:
Office.actions.associate("appendDisclaimerOnSend", appendDisclaimerOnSend);发布于 2022-11-16 08:57:04
要在外接程序中启用附加的发送功能,必须在文档中提到的AppendOnSend集合中包含ExtendedPermissions权限。您的舱单应包括以下条目:
<ExtendedPermissions>
<ExtendedPermission>AppendOnSend</ExtendedPermission>
</ExtendedPermissions>https://stackoverflow.com/questions/74409780
复制相似问题