Outlook js plugin - Show an custom alert dialog box instead of the task pane when using my add-in - outlook

I'm currently developing an Office plugin for Outlook using the OnMessageSend and SmartAlerts events that will perform a few simple checks before the email is being sent.
I'm able to display custom alerts on the taskpane but i would love to be able to display them on the send button.
I can't seem to change the default alert msgbox.
On Microsoft official website i found this information regarding Smart Alerts dialog messages:
"The dialog's title bar. Your add-in's name is always displayed there.
The message's format. For example, you can't change the text's font size and color or insert a bulleted list.
The dialog options. For example, the Send Anyway and Don't Send options are fixed and depend on the SendMode option you select.
Event-based activation processing and progress information dialogs. For example, the text and options that appear in the timeout and long-running operation dialogs can't be changed."
Anyone here knows it's possible to display something like this:
Here's my even.completed example:
event.completed({ allowEvent: false, errorMessage: "SAMPLE TEXT TO DISPLAY"});
It's seems i can't use breaks, change colors or size.
Here's my manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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">
<Id>dac64749-60d7-4579-9036-cb7308b6d444</Id>
<Version>1.0.0.0</Version>
<ProviderName>Validator</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Sample Text"/>
<Description DefaultValue="Sample Text"/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-128.png"/>
<SupportUrl DefaultValue="https://localhost:3000/"/>
<AppDomains>
<AppDomain>https://localhost:3000/</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Mailbox"/>
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.1"/>
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://localhost:3000/taskpane.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 xsi:type="ItemIs" ItemType="Appointment" FormType="Read"/>
</Rule>
<DisableEntityHighlighting>false</DisableEntityHighlighting>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.12">
<bt:Set Name="Mailbox"/>
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<!-- Specifies the event-based activation runtime. -->
<!-- For more information, see https://learn.microsoft.com/office/dev/add-ins/outlook/autolaunch. -->
<Runtimes>
<!-- HTML file that references the JavaScript event handlers. This is used by Outlook on the web. -->
<Runtime resid="WebViewRuntime.Url">
<!-- JavaScript file that contains the event handlers. This is used by Outlook on Windows. -->
<Override type="javascript" resid="JSRuntime.Url"/>
</Runtime>
</Runtimes>
<DesktopFormFactor>
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<OfficeTab id="TabDefault">
<Group id="CategoriesGroupMessageCompose">
<Label resid="CategoriesGroupLabel"/>
<Control xsi:type="Button" id="MessageComposeSelectButton">
<Label resid="SelectButtonLabel"/>
<Supertip>
<Title resid="SelectButtonLabel"/>
<Description resid="SelectButtonDescription"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16" />
<bt:Image size="32" resid="Icon.32x32" />
<bt:Image size="80" resid="Icon.80x80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="Taskpane.Url"/>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="CategoriesGroupAppointmentOrganizer">
<Label resid="CategoriesGroupLabel"/>
<Control xsi:type="Button" id="AppointmentOrganizerSelectButton">
<Label resid="SelectButtonLabel"/>
<Supertip>
<Title resid="SelectButtonLabel"/>
<Description resid="SelectButtonDescription"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16" />
<bt:Image size="32" resid="Icon.32x32" />
<bt:Image size="80" resid="Icon.80x80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="Taskpane.Url"/>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<!-- Enables the add-in on specified events. -->
<ExtensionPoint xsi:type="LaunchEvent">
<LaunchEvents>
<LaunchEvent Type="OnMessageSend" FunctionName="onMessageSendHandler" SendMode="PromptUser"/>
</LaunchEvents>
<!-- Identifies the runtime to be used by the add-in (also referenced by the Runtime element). -->
<SourceLocation resid="WebViewRuntime.Url"/>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="JSRuntime.Url" DefaultValue="https://localhost:3000/commands.js"/>
<bt:Url id="WebViewRuntime.Url" DefaultValue="https://localhost:3000/commands.html"/>
<bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="CategoriesGroupLabel" DefaultValue="Sample Name"/>
<bt:String id="SelectButtonLabel" DefaultValue="Sample Name"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="SelectButtonDescription" DefaultValue="Sample Name"/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>

That is not possible with smart alerts. You need to use the on-send feature and use the Dialog API for displaying a rich UI for the dialogs, see Use the Office dialog API in Office Add-ins for more information.
Read more about the on-send feature in the On-send feature for Outlook add-ins article.
Note, you can also post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.

Related

Show Outlook Add-in without compose or read pane active

Hello I am testing an outlook Add-in in visual studio, but I do not know that to change in the manifest to show the add-in enable all the time, without opening an email or read an email.
Currently is only enable or showing when an email is open, the rest of the time is disable
And I want to be enable all the time
<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<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>65ba8340-b53e-4941-a7bb-153669eea7fb</Id>
<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.0</Version>
<ProviderName>[Provider name]</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="OutlookWebAddIn1" />
<Description DefaultValue="OutlookWebAddIn1"/>
<IconUrl DefaultValue="~remoteAppUrl/Images/icon64.png"/>
<SupportUrl DefaultValue="http://www.contoso.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>AppDomain1</AppDomain>
<AppDomain>AppDomain2</AppDomain>
<AppDomain>AppDomain3</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="~remoteAppUrl/MessageRead.html"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteItem</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.3">
<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" />
<!-- Message Read -->
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
<OfficeTab id="TabDefault">
<!-- Up to 6 Groups added per Tab -->
<Group id="msgReadGroup">
<Label resid="groupLabel" />
<!-- Launch the add-in : task pane button -->
<Control xsi:type="Button" id="msgReadOpenPaneButton">
<Label resid="paneReadButtonLabel" />
<Supertip>
<Title resid="paneReadSuperTipTitle" />
<Description resid="paneReadSuperTipDescription" />
</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="messageReadTaskPaneUrl" />
</Action>
</Control>
<!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
</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="~remoteAppUrl/Images/icon16.png"/>
<bt:Image id="icon32" DefaultValue="~remoteAppUrl/Images/icon32.png"/>
<bt:Image id="icon80" DefaultValue="~remoteAppUrl/Images/icon80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html"/>
<bt:Url id="messageReadTaskPaneUrl" DefaultValue="~remoteAppUrl/MessageRead.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="My Add-in Group"/>
<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:ShortStrings>
<bt:LongStrings>
<bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a pane displaying all available properties. This is an example of a button that opens a task pane."/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
Outlook web add-ins work under the context of a particular item - composed or read. You can't run the add-in for the mailbox by default. It is not possible at least now. I'd suggest posting a feature request to Microsoft 365 Developer Platform Tech Community.
As a workaround, you may consider developing a COM based add-in where you can enable ribbon buttons independently of the selected item(s). See Walkthrough: Create your first VSTO Add-in for Outlook for more information.

How to use web.config to overwrite redirect rule for a file with same name but different extension?

I have an existing web.config file to redirect a page titled privacy.asp to privacy (without the .asp extension). It works as it should.
I now have a client who had a file privacy.html and I want to send a httpResponseStatus of permanent, that being /privacy.
Here is what I tried but when pulling up the privacy.html it resolves with the .html extension but the actual page is that of the .asp.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="privacy.html">
<system.webServer>
<httpRedirect enabled="true" destination="/privacy/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
<system.webServer>
<rewrite>
<rules>
<rule name="privacy" stopProcessing="true">
<match url="^privacy" />
<action type="Rewrite" url="privacy.asp" />
</rule>
</rules>
</system.webServer>
</configuration>
You could use below rewrite rule:
<rule name="privacy" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="privacy.html$" />
</conditions>
<action type="Redirect" url="privacy" appendQueryString="false" />
</rule>
<rule name="rewrite rule" stopProcessing="true">
<match url="privacy$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="privacy.asp" appendQueryString="false" logRewrittenUrl="true" />
</rule>
Note: do not forget to remove the location path and old URL rewrite rule.
Rregards,
Jalpa

which web.config to use in AspNetBoilerplate startup template?

Downloaded a free startup template and got a zip archive with the whole solution.
When unzipping the archive on windows I got a message asking whether to overwrite existing web.config file.
And indeed there are two web.config files below /src/myapp.Web.Host/.
The two file names differ in upper/lower case of the first letter.
One is named Web.config and the other web.config and the content differs.
Which one shall I use?
Options used:
ASP.NET Core 2.x
Target Framework: .NET Core (Cross Platform)
SPA with Angular
Include login, ...
One Solution
Until the issue fixes, you can use this web.config content...I tried, works perfectly.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<!-- ASPNET CORE SETTINS -->
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore
processPath="%LAUNCHER_PATH%"
arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"
startupTimeLimit="3600"
requestTimeout="23:00:00" />
<!-- REMOVE INFO LEAK HEADERS -->
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
<!-- MIME TYPES -->
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff" />
</staticContent>
<!-- IIS URL Rewrite for Angular routes -->
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
https://github.com/aspnetboilerplate/aspnetboilerplate/files/2149283/Web.config.zip

Allow G zip compression in wildfly-8.2.0.Final

I am running my java project on wildfly-8.2.0.Final, and i want to enable G-zip compression for the web content (js, css ,jsp etc), how to achieve it.
I got it done, we need to change the standalone.xml like this
search for and then make the changes as below
<subsystem xmlns="urn:jboss:domain:undertow:1.2">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
**<filter-ref name="gzipFilter" predicate="regex[pattern='(?:application/javascript|text/css|text/html)(;.*)?', value=%{o,Content-Type}, full-match=true]"/>**
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
**<gzip name="gzipFilter"/>**
</filters>
</subsystem>
(text in bold are the changes)

IIS rewrite how to intercept a set cookie value

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite requests" enabled="true">
<match url="(.*)" />
<action type="Rewrite" url="https://site1.domain1.net/{R:0}" />
</rule>
</rules>
<outboundRules>
<rule name="Rewrite outbound" enabled="true">
<match filterByTags="None" pattern="(.*)site1\.domain1\.net(.*)" />
<action type="Rewrite" value="{R:1}site2.domain2.com{R:2}" />
</rule>
<rule name="Rewrite cookie">
<match serverVariable="{HTTP_COOKIE}" pattern="(.*)site1\.domain1\.net(.*)" />
<action type="Rewrite" value="{R:1}site2.domain2.com{R:2}" />
</rule>
<preConditions>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
Ok so I have a frontend server which is accessed by site2.domain2.com and all traffic to it should be url rewrote as site1.domain1.net this works pretty easily. My problem is the site running on site1.domain1.net writes a cookie with a bunch of non-standard values for the application it runs. I need to be able to change a value written to the cookie for logon purposes.
The line I need to target is below
https%3a%2f%2fsite1.domain1.net%2flgn%2fauth2%2fagent%2fsrms%2frefresh
It doesn't have any standard tag like url=value or host=value it's just the line above, I need to catch the site1.domain1.net part and change to site2.domain2.com but not having much luck.
You can see in the code at the top where I tried to do this, unsuccessfully as I don't know much about playing with the cookies. Suggestions?
I was close but wasn't using the right stuff, though a bunch more trial and error I managed to figure it out.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite requests" enabled="true">
<match url="(.*)" />
<action type="Rewrite" url="https://site1.domain1.net/{R:0}" />
</rule>
</rules>
<outboundRules>
<rule name="Rewrite outbound" enabled="true">
<match filterByTags="None" pattern="(.*)site1\.domain1\.net(.*)" />
<action type="Rewrite" value="{R:1}site2.domain2.com{R:2}" />
</rule>
<rule name="Modify Cookie">
<match serverVariable="RESPONSE_Set_Cookie" pattern=".*" />
<conditions>
<add input="{R:0}" pattern="(.*)site1\.domain1\.net(.*)" />
</conditions>
<action type="Rewrite" value="{C:1}site2.domain2.com{C:2}" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>

Resources