Making your Outlook Add-in contextual

In this article I will demonstrate how to make an Outlook Add-in appear only on certain words in an email.


In previous articles we have looked at creating an Outlook Add-in and then how it works. Other than only being a sample app, this Add-in now appears on every email. What would be much more user friendly would be to make sure it only appear contextually, say if a word was in the body of an email for example.

In this article we are going to make the example Add-in only appear in emails with the word “Websockets” in it.

The XML Manifest

If we look at the properties of the napa dev console (the spanner on the left)


We can see that there are a number of options for the “read form”


At the top we can see “Edit read form XML” which is the manifest for the application. What we are looking at above is the visual representation of that XML file.


Looking at the Use regular expression activation rules to show a mail add-in in Outlook article we can find an example of a rule which check through the body of the email as plain text

<Rule xsi:type=”ItemHasRegularExpressionMatch”

But in my example I am going to look for the words Websockets and make sure that ignorecase is true (websockets or WebSOckEts would work)

<Rule xsi:type=”ItemHasRegularExpressionMatch”

I inserted the XML snippet above *inside* of the XML example code shown


and if you look at the non-XML version of the Read Form properties, you can see how this change is reflected


Running the application

If we look at the sample sample email as before – we will now no longer see any Marky Websockets Add-in


But if we find a new email with the word websockets inside it – we can see that it is contextually highlighted


Clicking on the word itself then triggers the sample Add-in to run



In this article we have looked at how we can simply add an Add-in contextually to the body of an email.





3 thoughts on “Making your Outlook Add-in contextual

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s