CloudTopia: Connecting o365, Apps, Azure and Cortana – Part 1
This is going to be a multi-part series to dissect and tear apart an application I tweeted about using the #yammerofjuly hashtag. This is an application I developed a couple of months ago as a means of illustrating some of the different complexities and options when building applications that span several cloud services. Through the course of this series I’ll start out by looking at the application overall, and then start breaking down some of the different components of it and how everything is tied together in the hopes that you can use it to integrate some of these same service connection points within your own applications.
NOTE: You can find ALL of the source code for everything in this series on GitHub at https://github.com/OfficeDev/CloudTopia-Code-Sample.
Here's some quick links to the whole series:
- Open Graph
- Web API
- Azure Integration
- Office 365 Integration
- Cortana, Speech and Windows Phone Integration
We’ll start by looking at the business requirements for the application. In our scenario we are working with a company that manages public events for their customers. They have the basic collaboration needs – for each event they create brochures, flyers, calendars, budgets, schedules, etc. In addition to that they want to be able to have a discussion forum around the event so they can talk through different aspects of the event with the team. They also want to have some way to get a feel for the buzz about the event that’s happening out in the public. They’re just looking for some way to get a feel for how their marketing of the event is working.
Given those requirements, I built the application I call CloudTopia. It uses several services and technologies that will be described in subsequent posts:
Yammer Open Graph
SharePoint Cloud App Model in a provider hosted app
Web API 2.1
Azure web sites
SQL Scheduler service
So as you can see, a lot of things working together here to make our solution. To start things off, I created a demo video of the application – you can watch it here: https://onedrive.live.com/redir?resid=96D1F7C6A8655C41!18616&authkey=!AC4csVj2oAU6B7M&ithint=video%2cmp4. After you’ve watched the video come back here and let’s talk a little bit about what you saw and how it was built.
Design and Architecture
Here’s a screenshot of the home page of the CloudTopia application with callouts for the different technologies and services being used:
Here’s a brief summary of each component:
Office 365 – the whole application starts out in an Office 365 site. I just created a new site in o365 tenant and made it the home page for the application.
Cloud App Model – the SharePoint 2013 Cloud App Model (CAM) was the starting point that I used to create this application. It ultimately relied upon several other services and technologies, but it was all delivered through CAM. One of the main features of the application – the UI you see in the o365 site – is just the standard iFrame that you get with a provider hosted application. From where it says “Upcoming Social Events” on down is all part of the app.
Azure Web Sites – one of the great things about CAM and provider hosted apps is that you can host them pretty much anywhere. In my case I decided to use one of the free Azure web sites that I get with my Azure subscription to be the “host” in my provider hosted application. It also underscores an important theme with this application: it’s called “CloudTopia” because it is 100% running in the cloud; there are NO on premises components to this application.
SharePoint List Data – all of the events and some related metadata is stored in a hidden list in the o365 Events site. The list is created by a remote event receiver when the application is installed. The event receiver creates the list, makes it hidden, and removes the list from the quick navigation links on the left side of a standard team site page. For more information on this process of creating a list this way in the host web of an application see my previous post here: https://blogs.technet.com/b/speschka/archive/2014/05/07/create-a-list-in-the-host-web-when-your-sharepoint-app-is-installed-and-remove-it-from-the-recent-stuff-list.aspx.
More o365 sites and Yammer Open Graph Items – each time a new event is added, a new o365 site is created for the event and a Yammer Open Graph item is created that is used or discussions on the event. More details follow below where I describe what all happens when you create a new site. In terms of working with Yammer Open Graph from .NET, I have already covered that in previous posts on my blog. You can go to the Open Graph specific post at https://blogs.technet.com/b/speschka/archive/2014/05/29/using-yammer-open-graph-in-net.aspx; it’s also part of the bigger Yammer toolkit for .NET that I’ve been building over time that started with this post: https://blogs.technet.com/b/speschka/archive/2013/10/05/using-the-yammer-api-in-a-net-client-application.aspx.
SQL Azure – the application uses SQL Azure to store certain data that is necessary to query twitter and add discussion items to Yammer Open Graph objects. In a later part in this series I’ll explain why I chose to use SQL Azure instead of SharePoint list data to store this information. As an added bonus, I used a free SQL Azure data instance that comes with an MSDN subscription. I’ll also cover that a little later.
Azure Scheduler – as you saw in the demo video, one of the things the application does is go find tweets that match the hashtags for our event and then add those tweets to the Open Graph discussion for the event. That work happens once a day and is triggered using a job in the Azure Scheduler service. Due to the low volume of these requests it falls within the number of free jobs that can be scheduled with Azure.
What Happens When You Create a New Event
There are quite a few things that get triggered when you go through the seemingly simple process of creating a new event. Let’s take a look at what happens.
A new o365 site is created for the event.
The out of the box Site Feed web part is removed from the new o365 site.
A new Open Graph (OG) item is created in Yammer.
The Url link for the OG item is set to be the Url of the new o365 site
This also means you can go into Yammer and just search for your o365 site Url and you’ll find the Open Graph object. Pretty cool.
A welcome post is added to the Open Graph discussion.
A script editor web part is added to the new o365 site; it uses Yammer Embed to display the feed for the Open Graph item.
A new item is added to the hidden SharePoint list in the host site where the App part is installed; that’s how it shows up in the event list in the host site.
A new item is added to SQL Azure with the Open Graph ID along with the new Site Url and Twitter tags.
That’s a lot of stuff! That’s also good for the intro of this series. In Part 2 of this series I’ll talk about some of the work I did around Yammer Open Graph objects in CloudTopia.