IMPORTANT NOTE: You must install the Web Application before the Office Add-in will work. During the Web application installation process all of the components and sample data which support the demo are provisioned. See the Install Web Application README for complete instructions.
The Office Add-in for Outlook and Outlook Web Access displays data from Office 365 SharePoint lists. The Mail App for Office is implemented with two main components.
- Office Add-in – xml file installed on the
- tenancy as an Exchange App
- Web pages – Part of the Property Manager web app running on ASP.NET MVC
These files contain the code which implements the Office Add-in for Outlook:
- /Controllers/MailAFOController.cs
- /Views/MailAFO/Redir.cshmtl
- /Views/MailAFO/Index.cshtml
- /Models/MailAFOModel.cs
- /Models/Dashboard.cs
The sections below provide more information about these components and how to get up and running.
The Office Add-in for Outlook runs on an ASP.NET Web site. You must configure the Office Add-in for Outlook to use the web site where you deployed the Property Manager web app. To configure the Office Add-in for Outlook to use your web site follow these instructions.
-
Open the MailApp Visual Studio Solution
-
In the MailApp project, open the MailApp.xml file
-
Replace the SourceLocation endpoints in the DesktopSettings, TabletSettings, and PhoneSettings nodes with the URL to your Property Manager web app ASP.NET web site
Use the following template for the SoureLocation URL: https://<Your Web Site>.azurewebsites.net/Mailafo/redir
Note: You must use an HTTPS URL for Office Add-in for Outlook.
-
Save MailApp.xml
-
Right click the MailApp project and select Publish
-
Click Package the app
- Log into your Office 365 Tenancy with your admin account
- Click the app launcher button, then click the Admin app 
- In the left menu, click Exchange
- Under organization, click apps
- Click the + icon to add a new app
- Select Add from file
- In the dialog select the MailAppManifest.xml file you created when you published the MailApp project
- Click next
- After the Office Add-in for Outlook is uploaded, select it in the list. It is named Property Details.
- Click the Edit button in the toolbar
- In the Specify user defaults section, select the Optional, enabled by default radio button
- Click save
Office Add-in for Outlook Installation Complete!
The Office Add-in for Outlook uses the SharePoint REST APIs to return list item data and pictures from the SharePoint site collection. The REST APIs use a different token to authenticate than the token used to authenticate to Exchange in Office 365.
Signing into Office 365 and viewing emails does not obtain the token used to authenticate to the SharePoint site. Furthermore, when the Office Add-in for Outlook makes the SharePoint REST API calls, the login page for the SharePoint site collection cannot be displayed because the Office 365 login page sets the X-Frame-Options to DENY. This setting is designed to ensure the Office 365 login page cannot open in an IFRAME. Because the Office Add-in for Outlook is displayed in an IFRAME the login page cannot be loaded. Since this is the case you must first log into the SharePoint site collection before you try to access the Office Add-in for Outlook.
To log into the SharePoint site collection, open a web browser and navigate to https://.sharepoint.com/sites/SuitelevelAppDemo.
In future releases the Unified API will include the ability to query SharePoint list items and document libraries. Once the Unified API includes this functionality the Office Add-in for Outlook will be updated to use the Unified API. After the Office Add-in for Outlook has been converted to use the Unified API the separate token needed to access the SP REST APIs is no longer needed and there will be no need to log into the SharePoint site collection before accessing the Office Add-in for Outlook.
When demo users open an email with the string Incident ID: <number> in the email body they can view the Incident details in the Office Add-in for Outlook by clicking the Property Details link.

When the Office Add-in for Outlook loads, users are taken to a redirect page which uses office.js to extract the Incident ID from the email body. This page includes the text Redir so you can see it happening in the demo. In a production scenario you might display loading text or leave this page blank.

The redirect page then uses JavaScript to redirect to another controller (index.cshtml) and passes the IncidentId on the query string. The second controller uses the IncidentId passed to it to invoke the server side Office 365 ASP.NET APIs to retrieve the data from SharePoint.

The Office Add-in for Outlook included in the demo renders properly in PC web browsers but it does not render in iOS devices in Safari, the OWA app, or the native iOS email client. At this time they are not supported in Safari, the OWA app, or the native iOS email client.
The links in the workflow emails which open the native iOS apps on an iOS device work when using the native iOS email client. At this time they are not supported in Safari or the OWA app.
Copyright (c) Microsoft, Inc. All rights reserved. Licensed under the Apache License, Version 2.0.