This sample has been moved to
SharePoint-Add-in-CSOM-BasicDataOperations.
The sample demonstrates how to read and write list and list item data by using objects and methods in the SharePoint 2013 client object model (CSOM). Additionally, it demonstrates how to obtain the context and access tokens that are necessary for reading and writing data in a provider-hosted app for SharePoint.
The code that uses the CSOM is located in the Home.aspx.cs file of the BasicDataOperationsWeb 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 app, which displays the controls for viewing and adding lists to and from the parent web

Figure 2. View list items from a list on the parent web

The following figure shows an example of how to use this app for SharePoint to add list items.
Figure 3. Add list items to a list on the parent web

The sample demonstrates how to read and write list and list item data by using objects and methods in the SharePoint 2013 client object model (CSOM). Additionally, it demonstrates how to obtain the context and access tokens that are necessary for reading and writing data in a provider-hosted app for SharePoint.
The code that uses the CSOM is located in the Home.aspx.cs file of the BasicDataOperationsWeb 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 app, which displays the controls for viewing and adding lists to and from the parent web
Prerequisites
This sample requires the following:- A SharePoint 2013 development environment that is configured for app isolation and OAuth
- Visual Studio 2012 and SharePoint development tools in Visual Studio 2012 installed on your developer computer
- Basic familiarity with the SharePoint CSOM and C#
Key components of the sample
The basic data operations sample app contains the following:- BasicDataOperations project, which contains the AppManifest.xml file
- BasicDataOperationsWeb project
- 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 SharePoint CSOM to read and write data
- web.config file
Configure the sample
To configure the perform basic data operations by using CSOM sample app, 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
- Choose Trust It on the consent page to grant permissions to the app.
- Use the app’s interface to read, create, and update lists and add list items on the parent SharePoint 2013 site.
Examples
The following figure shows an example of how to use this app for SharePoint to view list items.Figure 2. View list items from a list on the parent web
The following figure shows an example of how to use this app for SharePoint to add list items.
Figure 3. Add list items to a list on the parent web
No comments:
Post a Comment