This has been removed. Please use the sample at: SharePoint Add-in REST\OData Basic Data perations. The description
below does not apply to the new sample.
SharePoint 2013: Hello World remote app using REST |
Summary: Learn how to create a basic "hello world"
provider-hosted app for SharePoint that uses the SharePoint REST
interface to read information about a SharePoint 2013 site from a remote
web application.
Last modified: July 01, 2012
In this article
Description of the sample
Prerequisites
Key components of the sample
Configure the sample
Build the sample
Run and test the sample
Troubleshooting
Change log
Related content
In this article
Description of the sample
Prerequisites
Key components of the sample
Configure the sample
Build the sample
Run and test the sample
Troubleshooting
Change log
Related content
Description of the sample
The sample demonstrates how to read data that conforms with the OData
protocol from the REST endpoints where the basic SharePoint entities,
such as lists and users, are exposed. Additionally, it demonstrates how
to parse Atom-formatted XML returned from
these endpoints.
The code that uses the REST APIs is located in the Home.aspx.cs file of the BasicSelfHostedAppRESTWeb project. The following screen shot shows how the Home.aspx page in the app appears after you install and launch the app.
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 is located in the Home.aspx.cs file of the BasicSelfHostedAppRESTWeb project. The following screen shot shows how the Home.aspx page in the app appears after you install and launch the app.
Figure 1. Home.aspx page in the Hello World remote app for SharePoint using REST
Prerequisites
This sample requires the following:
-
A SharePoint 2013 development environment that is configured for app isolation and OAuth
-
Visual Studio 2012 and Office Developer Tools for Visual Studio 2012 installed on your developer computer
-
Basic familiarity with RESTful web services
Key components of the sample
The sample app contains the following:
-
BasicSelfHostedAppREST project, which contains the AppManifest.xml file
-
BasicSelfHostedAppRESTWeb project, which contains the following:
-
Home.aspx file, which contains the HTML and ASP.NET controls for the app's user interface
-
Home.aspx.cs file, which contains the C# code that uses the REST APIs to read and write data to and from the parent web
-
web.config file
-
Home.aspx file, which contains the HTML and ASP.NET controls for the app's user interface
Configure the sample
To configure the Hello world remote app using REST sample, update the
SiteUrl property of the solution with the URL of the home page of your SharePoint 2013 site.
Build the sample
Press F5 to build and deploy the app.
Run and test the sample
-
Choose Trust It on the consent page to grant permissions to the app.
-
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 you
can 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
Version |
Date |
---|---|
First version |
July 16, 2012 |
Related content
-
How to: Create a basic provider-hosted app for SharePoint
-
SharePoint 2013 development overview
-
Programming using the SharePoint 2013 REST service
-
Getting started developing SharePoint apps
-
Building a basic SharePoint-hosted app
-
OAuth in SharePoint 2013 Preview
-
Architecture of the app for SharePoint model
-
Apps for SharePoint vs. classic SharePoint solutions
-
Detailed introduction to the SharePoint app model
-
Open Data Protocol
-
OData: JavaScript Object Notation (JSON) Format
-
OData: AtomPub Format
No comments:
Post a Comment