How to Create CSOM App in SharePoint 2013

To learn how to create a Client Side Object Model (CSOM) project solution in SharePoint 2013 app in visual studio 2013, do the following:

A provider hosted app is one way to go.  Autohosted is another.

You can select either of those options when you create a new app for SharePoint. With that you get a very simple template that already has some basic code calling back to SharePoint via CSOM.

There is a more advanced option as well. If you already have an existing Visual Studio solution with a SharePoint-hosted app and you’d like to continue using it:

  1. Add New Project
  2. Select the “Web” category
  3. Select any of the available web project types. e.g. MVC or Web Forms
  4. Select SharePoint App project
  5. Locate Web Project Property
  6. Select your new web project from the drop down

When you do that, VS will automatically reconfigure your app for SharePoint to an autohosted app and add TokenHelper.cs to the web project.