SharePoint 2013 Preview – Initial look as a Developer

SharePoint 2013 Preview has been released for a while now and figured it was time that I contributed to the growing number of articles and information that is being made available. Having read around a lot of the changes I'm particularly interested into what things we can expect as developers – what can we do now that we couldn't before, what things have changed and what things are no longer available. If I look at the typical things I do day-to-day – creating Content Types, List Definitions, workflows, web parts etc – what do all of these look like in 2013? Can I approach these in the same way as I did in 2010 or are the new aspects I need to consider? 2013 may introduce new components which means I can approach some of the development differently. These are the sort of questions that I'm trying to look at and answer so that when 2013 is released and I start working on projects I can do things the right way!

I am very much going to look at this from the Visual Studio side of things – SharePoint development isn't just about Visual Studio but since that is where I spend a lot of my time with the projects I work on so that's where I'm starting.

The App Model

This is perhaps one of the biggest changes that will impact developers as it opens up a number of different options on how we produce customisations and how we package them up. As with 2010 we had the option of building Farm or Sandbox solutions, with 2013 the main options are Farm or Apps (Sandbox is technically still available but deprecated). So if you've tended towards Sandbox solutions with 2010 then the Apps are definitely going to be of interest. The new App model is well worth reading up on as there is a lot to it and it introduces new ideas on how we can approach things. For a couple of starting points, the full Microsoft explanation can be found on MSDN and another article I found very useful was one that Eric Shupps wrote which you can find here.

So what is it with Apps? With SharePoint 2010 we gained the idea of 'Sandbox Solutions', being able to run code in a more restricted manner, limiting what it could access, the context it ran under etc. The App model in 2013 takes this idea much further – it not only changes how we can deploy customisations to SharePoint but also determines what we can deploy and where they are deployed to. We can now build apps that contain no server-side code which entirely runs client-side making use of things like the SharePoint JavaScript object model. We have options for apps which then don't have to rely on SharePoint at all but can be hosted independently.

SharePoint 2013 allows us to have 3 different types of apps – SharePoint-hosted, Autohosted and Provider-hosted. What goes into each one is worth several articles each so I'm not going to go into detail here – plenty of people have so a quick search online should help get you started.

Whilst the App model is a big component of 2013 we still have the option to create the more traditional Farm solutions with SharePoint 2013. These are build, packaged and deployed pretty much in the same way as 2010. In 2010 the recommendation was start with a Sandbox and only switch to a Farm solution if you have to, a similar thinking it being applied in 2013 – start with an app! If you can accomplish what you need to do with an App, build it as that.

How does this look in Visual Studio 2012?

Before you start looking at Visual Studio you may need to setup your development environment so that you can host you apps locally. Here's the link to MSDN on how to do – again lots of people have also detailed this online so there are a number of good resources available.

How to: Set up an on-premises development environment for apps for SharePoint

Assuming you have everything setup, the first step is to create a new Visual Studio Project. As long as you have installed the SharePoint Tools (as part of Office Developer Tools for Visual Studio 2012) you should find the option to create a  'App for SharePoint 2013′ which you should find under the 'Office/SharePoint' category. If you want to create a Farm solution then you can find this option under 'SharePoint Solutions' and 'SharePoint 2013 Project'.

(Note – the first time I installed Visual Studio 2012 and the SharePoint Extensions I found that Visual Studio didn't contain any templates for SharePoint 2013. The category was listed, but the template 'App for SharePoint 2012′ was missing. I don't know what the issue was but after uninstalling and reinstalling Visual Studio 2012 it fixed the problem).

Visual Studio 2012 - Creating an App Project Step 1

This next screen is where we can specify what site to deploy to, but rather than selecting 'Farm' or 'Sandbox' Solution, we now get a choice for SharePoint-hosted, Auto-hosted and Provider-hosted. At this point you should know what your app needs to do and so what type of app you will be creating. In 2010 it was straight-forward to change a solution between Farm and Sandbox, with the apps it isn't so straight-forward as the projects contain different elements!

Visual Studio 2012 - Creating an App Project Step 2

What gets created next will depend on what option you select as Visual Studio creates different elements within the project based around what you choose.

SharePoint-hostedAutohostedProvider-hosted
SharePoint Hosted Default Project

You can see that the projects that are created are different between SharePoint-Hosted and the other two – the key difference being that the Autohosted and Provider-Hosted projects also include a web component. This is done to how the different apps are physically hosted. In the case of a SharePoint-hosted app, the app itself lives within your SharePoint site where as the other two are hosted externally – hence the sites.

Once your app project has been created you can start developing. Of course there are different ideas to developing. If you're building a SharePoint-hosted app for example then you'll likely need to work with the JavaScript object model and possibly jQuery. This might be quite different to the type of development that you've been used to. I know for me that I've not really done much work with the client object models in 2010, so that will take a little getting used to. The good news is that most of the client object models haven't changed that much so if you've used them in 2010, 2013 should be almost the same.

 

A lot of great information has already been published by people on 2013 and I'm sure over the coming months we'll see more and more information being made available. Whether you're going to be picking up 2013 the day it is released or not I would suggest starting to read up on it!