Blog Written by: David McWee, SharePoint Architect
View David's Blog at: http://dmcwee.wordpress.com/
With the introduction of the 2013 product line, both Office and SharePoint, Microsoft has chosen to implement an App model. In the last blog I wrote about how this App model is very similar to Facebook’s App Model. I also mentioned, but didn’t go into great detail that SharePoint and Office Development share the App model concept. In this blog I want to demonstrate how to implement an App that works with SharePoint and Office. I will use the Office 365 Developer Preview which includes all the 2013 products hosted in the Microsoft Office 365 Cloud. If you haven’t already I recommend signing up for your own instance, it’s free and eliminates the need for you to have on-premise development servers. In addition, you have access to the Napa Tools which are a web based version of Visual Studio, of course it is very stripped down, to help with some of the simple app development. My initial goal writing this demo was to use the Napa tool, but I realized pretty quickly that wouldn’t be a possibility.
This article is going to focus on how we can augment the Hosted Outlook Web Application contact information with data that is stored in SharePoint. Imagine receiving an e-mail from a customer within your Outlook Web Mail and being able to retrieve the past orders, address, account information, etc for that customer without ever having to leave that e-mail.
How Do We Do It?
Following retrieving the information we call our proxy service with the URL of the Site and the list we want to get information from. In this example we are using the Contacts list, but we could be pointed to a BCS list from a system like CRM or any other type. The service is going to return a response message, which basically provides debugging information from the services as well as a list of contacts where the Title (aka Last Name) and Address have been populated. Once we get this information back we will update our html file with the information.
In the REST Proxy we have a bit more work to do. Because the app is hosted outside of the Office 365 environment, where Outlook and SharePoint run, we have to act as an external application. As such we will need to create a client context, load it, and then execute any queries necessary to retrieve our information. Additionally, because our authentication context is only with Outlook we will need to authenticate with SharePoint in order to successfully receive the information. To simplify the token authentication with Office 365 I found the MsOnlineClaimsHelper which was created by Wictor Wilen and would strongly recommend you take advantage of his work.
Now that we have a functional web services, we can go ahead and test the application to see what we get.
That is it, we just modified the Office 365 Outlook Web Application to include our custom app and the information from SharePoint.