moinakphotoThis post walks through a published app for Office, along the way showing you everything you need to get started building your own app for Office that uses a data service from the Windows Azure Marketplace. Today’s post is brought to you by Moinak Bandyopadhyay. Moinak is a Program Manager on the Windows Azure Marketplace team, a part of the Windows Azure Commerce Division.

 

Ever wondered how to get premium, curated data from Windows Azure Marketplace, into your Office applications, to create a rich and powerful experience for your users? If you have, you are in luck.

Introducing the first ever app for Office that builds this integration with the Windows Azure Marketplace – US Crime Stats. This app enables users to insert crime statistics, provided by DATA.GOV, right into an Excel spreadsheet, without ever having to leave the Office client.

One challenge faced by Excel users is finding the right set of data, and apps for Office provides a great opportunity to create rich, immersive experiences by connecting to premium data sources from the Windows Azure Marketplace.

What is the Windows Azure Marketplace?

The Windows Azure Marketplace (also called Windows Azure Marketplace DataMarket or just DataMarket) is a marketplace for datasets, data services and complete applications. Learn more about Windows Azure Marketplace.

This blog article is organized into two sections:

  1. The U.S. Crime Stats Experience
  2. Writing your own Office Application that gets data from the Windows Azure Marketplace

The US Crime Stats Experience

You can find the app on the Office Store. Once you add the US Crime Stats app to your collection, you can go to Excel 2013, and add the US Crime Stats app to your spreadsheet.

Figure 1. Open Excel 2013 spreadsheet

blog_CrimeStats_fig01

Once you choose US Crime Stats, the application is shown in the right pane. You can search for crime statistics based on City, State, and Year.

Figure 2. US Crime Stats app is shown in the right task pane

blog_CrimeStats_fig02

Once you enter the city, state, and year, click ‘Insert Crime Data’ and the data will be inserted into your spreadsheet.

Figure 3. Data is inserted into an Excel 2013 spreadsheet

blog_CrimeStats_fig03

What is going on under the hood?

In short, when the ‘Insert Crime Data’ button is chosen, the application takes the input (city, state, and year) and makes a request to the DataMarket services endpoint for DATA.GOV in the form of an OData Call. When the response is received, it is then parsed, and inserted into the spreadsheet using the JavaScript API for Office.

Writing your own Office application that gets data from the Windows Azure Marketplace

Prerequisites for writing Office applications that get data from Windows Azure Marketplace

 

  • Visual Studio 2012
  • Office 2013
  • Office Developer Tools for Visual Studio 2012
  • Basic Familiarity with the OData protocol
  • Basic familiarity with the JavaScript API for Office
  • To develop your application, you will need a Windows Azure Marketplace Developer Account and a Client ID (learn more)
  • Web server URL where you will be redirected to after application consent. This can be of the form ‘http://localhost:port_number/marketplace/consent’. If you are hosting the page in IIS on your development computer, supply this URL to the application Register page when you create your Marketplace app.

How to write Office applications using data from Windows Azure Marketplace

The MSDN article, Create a Marketplace application, covers everything necessary for creating a Marketplace application, but below are the steps in order.

  1. Register with the Windows Azure Marketplace:
    • You need to register your application first on the Windows Azure Marketplace Application Registration page. Instructions on how to register your application for the Windows Azure Marketplace are found in the MSDN topic, Register your Marketplace Application.
  2. Authentication:
  3. Receiving Data from the Windows Azure Marketplace DataMarket service

To get a real feel of the code that powers the US Crime Stats, be on the lookout for the release of the code sample on the Office 2013 Samples website.