Skip to main content

Sender Sentiment and Sender Mail Tips Mail Addin for Office365

Mail Addin's are a feature of Exchange and Office365 introduced first in 2013 as a way of having a unified Client App experience across Outlook, OWA and now the Outlook mobile clients (vs the old Com based addin which still works but in Outlook only). One of the new features in MailApps in Office365 is the ability to now use the Outlook REST endpoint (EWS has been available in Mail Addin's since release). While both EWS and REST are functionality the same (eg they both are Mailbox data API's) in terms of their use in a Mail Addin the REST API offers a faster and easier development experience over EWS. Primarily because in EWS you have to build your SOAP posts in XML and parse their results which if you have worked with XML in Javascript is never a trivial thing. REST on the other hand because your requests and responses are using JSON (JavaScript Object Notation) from a integration perspective this is easier to handle and debug in JavaScript which is the primary language you use when creating Addin's.

To try out the REST API in Mail Addin's I've created a few sample Mail Addin's that shows some novel ways of using this REST API in Outlook Clients.

Sender Sentiment Mail App

 A few weeks okay I touched on the new Sentiment property that is available on some email in Office 365 in this post . In the below Mail App I've used this property to show the sentiment statistics of email from the sender of a Message. It works by first making  a REST query of the Inbox for all the Messages from the current Sender of the Message you activate it on over the last month, it then does some quick counts to display some simple stats for Last 30 and 7 days back to user. Then on the messages that have the Sentiment property set (and not all do) it does a batch request on those messages to get the full sentiment property information (this is necessary because of the property size see my other post). And then displays back to user the following information about the positivity or negativity (based on the polarity property of the emotive profile) of that senders email over the last Month or 7 days eg



Sender Mail Tips Mail App

Mail Tips are typically used when sending a Messages to give extra information or prevent users from making basic mistakes. However this information can be equally as useful on any received message. So what I've done is put together a Mail App that will simply show you all the Mail Tips that are available for a particular sender. Because the MailTips operation in REST is still in its beta state this Mail App calls the beta endpoint. It produces a results like


Dev Tips

A few dev tips if your going to write one yourself. First start with Visual Studio 2017 the templates for Mail Apps have improved a lot from pervious version of VS so you can get up and going with a working sample in a few minutes. If your designing something that will be primarily used in the Outlook desktop client then change the startup project to Office Desktop (Edge will be the default eg).


This is important because when your Addin is side loaded into the Outlook Desktop client they will be rendered via Internet Explorer which is not as compatible from a JavaScript perspective as Edge is with chrome and the like so you may have certain code that will work fine in Edge\Chrome but not render in IE so starting with the lowest common denominator which is Outlook in this case will generally save you time when you look to test your Addin on different platforms.

The code and using

All the code from this post is in the following GitHub repo's  https://github.com/gscales/gscales.github.io/tree/master/SenderSentiment and  https://github.com/gscales/gscales.github.io/tree/master/SenderMailTips  . The code is actually hosted on GitHub Pages and can be used straight from the repository if you want to test it yourself the manifest files can be loaded as custom add-ins from From URL eg



Sender Sentiment Addin

https://gscales.github.io/SenderSentiment/SenderSentiment.xml

Sender MailTips

https://gscales.github.io/SenderMailTips/SenderMailtips.xml

(This is all POC code so use it for testing only, also not optimized for performance)

There are whole number of really cool things you can do with Mail Addin's if you are looking for someone to help build a Mail Addin for you or help with any other Exchange related development tasks or scripting/automation. I'm available to take on work at the moment so please contact me at gscales@msgdevelop.com . I'd also be interested in hearing from any companies that want to sponsor open source projects around Exchange and Office365 development.

Popular posts from this blog

The MailboxConcurrency limit and using Batching in the Microsoft Graph API

If your getting an error such as Application is over its MailboxConcurrency limit while using the Microsoft Graph API this post may help you understand why. Background   The Mailbox  concurrency limit when your using the Graph API is 4 as per https://docs.microsoft.com/en-us/graph/throttling#outlook-service-limits . This is evaluated for each app ID and mailbox combination so this means you can have different apps running under the same credentials and the poor behavior of one won't cause the other to be throttled. If you compared that to EWS you could have up to 27 concurrent connections but they are shared across all apps on a first come first served basis. Batching Batching in the Graph API is a way of combining multiple requests into a single HTTP request. Batching in the Exchange Mail API's EWS and MAPI has been around for a long time and its common, for email Apps to process large numbers of smaller items for a variety of reasons.  Batching in the Graph is limited to a m

Sending a Message in Exchange Online via REST from an Arduino MKR1000

This is part 2 of my MKR1000 article, in this previous post  I looked at sending a Message via EWS using Basic Authentication.  In this Post I'll look at using the new Outlook REST API  which requires using OAuth authentication to get an Access Token. The prerequisites for this sketch are the same as in the other post with the addition of the ArduinoJson library  https://github.com/bblanchon/ArduinoJson  which is used to parse the Authentication Results to extract the Access Token. Also the SSL certificates for the login.windows.net  and outlook.office365.com need to be uploaded to the devices using the wifi101 Firmware updater. To use Token Authentication you need to register an Application in Azure https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually  with the Mail.Send permission. The application should be a Native Client app that use the Out of Band Callback urn:ietf:wg:oauth:2.0:oob. You need to authorize it in you tenant (eg build a small ap

How to test SMTP using Opportunistic TLS with Powershell and grab the public certificate a SMTP server is using

Most email services these day employ Opportunistic TLS when trying to send Messages which means that wherever possible the Messages will be encrypted rather then the plain text legacy of SMTP.  This method was defined in RFC 3207 "SMTP Service Extension for Secure SMTP over Transport Layer Security" and  there's a quite a good explanation of Opportunistic TLS on Wikipedia  https://en.wikipedia.org/wiki/Opportunistic_TLS .  This is used for both Server to Server (eg MTA to MTA) and Client to server (Eg a Message client like Outlook which acts as a MSA) the later being generally Authenticated. Basically it allows you to have a normal plain text SMTP conversation that is then upgraded to TLS using the STARTTLS verb. Not all servers will support this verb so if its not supported then a message is just sent as Plain text. TLS relies on PKI certificates and the administrative issue s that come around certificate management like expired certificates which is why I wrote th
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.