/mail-addin-for-outlook-consuming-office365-api

Mail Add-In for Outlook - consuming Office 365 APIs - backend is Node.js, Adal.js for Authentication and Angular.js as frontend

Primary LanguageJavaScriptApache License 2.0Apache-2.0

More: http://blog.agile9.net/2015/08/18/mail-addin-for-outlook-using-office-365-apis-adal-js-angularjs-webapi-azure-ad/

Mail Addin For Outlook Using Office 365 APIs (ADAL.JS, ANGULARJS, WEBAPI, AZURE AD)

Summary

This sample demonstrates mail add-in for Outlook which extracts data from a mail message and retrieves data from Office 365 APIs. Node.js is used for server side code, AngularJS for front-end and for authentication purposes Adal.js + Azure AD. Additionaly(not required to run) there is .NET WebApi project to show how we can retrive data from custom REST APIs. (projectUrl)

Applies to

  • Outlook on Office 365 (outlook.office365.com) - Google Chrome

Prerequisites

Solution

Solution Author(s) Twitter
Context Matej Vodopivc (Agile9.net) @matejvodopivc

Version history

Version Date Comments
1.0 Aug 29rd 2015 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.


Mail Addin For Outlook Using Office 365 APIs

This code sample demonstrates the use of an add-in for Outlook for showing additional data to user from Office 365 APIs and custom REST APIs.

Video of the working sample: YouTube - Mail Addin for Outlook - Office 365, Adal.js, AngularJS, Node.js

More images of this sample: blog.agile9.net

1. Building this sample

This sample consists of 3 primary components:

  1. Node.js server side code - running locally (can be hosted anywhere, Azure for example fully supports Node.js arhitecture)
  2. Addin for Office Manifest - defines how our add-in is activated within Outlook
  3. Front-end code - HTML markup and AngularJS Javascript for interacting with the server-side API

1.1 Configure Azure Active Directory

This is already well documented. See Step 2: Register the sample with your Azure Active Directory tenant

Note:

  1. Make sure you create Key
  2. make changes to Manifest file (Download, oauth2AllowImplicitFlow: true, Upload back)
  3. give an app required permissions (Exchange, Sharepoint Online)

1.2 Configure App Settings

  1. Open project location in Explorer. Open src/app.routes.js
  2. Change tenant name (replace "agile9" with your Office 365 tenant name)

1.3 Install Node.js Dependecies

  1. Open source location on local computer using Explorer.
  2. Open Command Prompt in this folder (Hold SHIFT + Right click -> Open Command Windows here)
  3. Run: npm install bower
  4. Run: npm install

1.4 Upload Office Manifest to Exchange

  1. Navigate to portal.office.com
  2. Select Admin
  3. In the left side menu select ADMIN -> Exchange
  4. On Exchange admin center page select "add-ins" under "organization" group
  5. Select Add from File and upload manifest

1.5 Running the sample

  1. Follow steps in 1.2 to navigate to right location using CMD
  2. Run: npm start
  3. Open in Chrome browser: https://localhost:8443/#/
  4. Accept SSL warning (certificate is not verifed by know authority)
  5. Open https://outlook.office365.com and see the result

1.6 Hosting/Running this sample in Azure

  1. You will need to replace server.js with content from server-production.js.
  2. For the rest you should follow this article Build and deploy a Node.js web app in Azure App Service