This sample has been replaced with the following samples:

SharePoint-Add-in-REST-OData-BasicDataOperations

SharePoint-Add-in-REST-OData-CrossDomain

 

 


The sample demonstrates how to read from and load data that conforms with the OData protocol to the REST endpoints where the list and list item entities are exposed. Additionally, it demonstrates how to parse Atom-formatted XML returned from these endpoints and how to construct JSON-formatted representations of basic SharePoint entities so that you can perform Create and Update operations on them.

The sample also demonstrates best practices for retrieving form digest and eTag values that are required for Create and Update operations on lists and list items.

For more information about the SharePoint REST APIs, see Programming using the SharePoint 2013 REST service. For more information about working with JSON, Atom, and OData, see OData: JavaScript Object Notation (JSON) Format and OData: AtomPub Format.

The code that uses the REST APIs and that builds the interface is located in the Home.aspx.cs file of the RESTHelperAppWeb project.

Prerequisites

This sample requires the following:

Key components of the sample

The sample app contains the following:

Configure the sample

To configure the Build REST queries and use REST to traverse a site sample app, update the SiteUrl property of the solution with the URL of the home page of your SharePoint 2013 Preview 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. Use the app’s interface to drill into the parent web’s site structure and find basic SharePoint entities, such as webs and lists, and the endpoints where those entities are exposed. You can also jump directly to pages that display the endpoints for all of the parent web’s lists and users.

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