Archive for August 21, 2012

SharePoint 2013 Hosted App

This will be my first post on SharePoint 2013. The buzz around the App Model is huge and so I dove in on a very basic level. Just to show how easy an App can be hosted in SharePoint and can consume Data or connect to popular websites. Like Facebook.

No worries, no Authentication is being used. This Post it’s just to show how easy it is to create a SharePoint App and consume “free” data.

First things first

The very first thing we should do is follow the steps described by MS to setup your development machine for App Development.
http://msdn.microsoft.com/en-us/library/office/apps/fp179923%28v=office.15%29

Andrew Connell created a PS Script for this:
http://www.andrewconnell.com/blog/archive/2012/08/07/registering-sharepoint-2013-high-trust-apps-using-s2s-the-easy.aspx

Create a new App

First start Visual Studio 2012 RC. Create a new Project and choose App for SharePoint 2013

Schermafbeelding 2012-08-21 om 17.08.34

Next give your App a name and fill in the Developer Site (created while setting up your app domain). I chose my default webapplication to be a Developer Site.

For this App we choose SharePoint-hosted.

Schermafbeelding 2012-08-21 om 17.09.46

Now we can see the App Template contains some modules for Scripts, Images, Pages and CSS files. Also notice the AppManifest.xml file which holds important info about your App.

Schermafbeelding 2012-08-21 om 17.19.38

Facebook Data

For this app I use the standard Facebook Graph API. We can use jQuery to get JSON data from the url we like. In this example I chose Microsofts Facebook page.

http://graph.facebook.com/microsoft

To simply bind the data on my Default.aspx page I use KnockOut JS. This is a very easy and fast way of binding data.

Result

The project that you can download, results in an App that is displaying Page data from Facebook. It looks like this:

Schermafbeelding 2012-08-21 om 16.58.10

Schermafbeelding 2012-08-21 om 16.57.40

DOWNLOAD MyFBPage.proj