SharePoint 2013: Hello World remote app using CSOM


C#, SharePoint Server 2013, SharePoint Foundation 2013, apps for SharePoint
Authentication, data and storage
Web, Cloud
en-US
3/19/2013

The sample demonstrates how to read data about the parent SharePoint site on which the app is installed by using OAuth and the SharePoint client object model (CSOM).

The code that uses the SharePoint CSOM is located in the Home.aspx.cs file of the BasicSelfHostedAppWeb project. The following screen shot shows how the Home.aspx page of the app appears after you install and launch the app.

Figure 1. Home.aspx page in the Hello World remote app for SharePoint using CSOM

Prerequisites

This sample requires the following:

Key components of the sample

The sample app contains the following:

Configure the sample

To configure the hello world remote app using CSOM sample, update the SiteUrl property of the solution with the URL of the home page of your SharePoint 2013 site.

Build the sample

Press the F5 key to build and deploy the app.

Run and test the sample

  1. Choose Trust It on the consent page to grant permissions to the app.
  2. Choose Populate Data to see some basic information about the parent web.

Example

The following figure shows an example of the kinds of information that this sample app can read and display.

Figure 2. View populated data about the parent web

Troubleshooting

The following table lists common configuration and environment errors that prevent the sample from running or deploying properly and how to solve them.

Problem Solution
Visual Studio does not open the browser after you press the F5 key. Set the app for SharePoint project as the startup project.
HTTP error 405 Method not allowed. Locate the applicationhost.config file in %userprofile%\Documents\IISExpress\config.

Locate the handler entry for StaticFile, and add the verbs GET, HEAD, POST, DEBUG, and TRACE.



 


 

 

 

Change log

First version: July 16, 2012

Related content