OfficeDev/Project-Add-in-REST-BasicDataOperations

Name: Project-Add-in-REST-BasicDataOperations

Owner: Office Developer

Description: Use the Project REST endpoints to perform create, read, update, and delete operations on Projects from a Project Add-in

Created: 2016-09-15 06:21:49.0

Updated: 2017-12-28 21:36:05.0

Pushed: 2018-01-31 20:28:21.0

Homepage: null

Size: 42

Language: C#

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Basic CRUD operations in Project Add-ins using the REST APIs

Summary

Use the Project REST endpoints to perform create, read, update, and delete operations onprojects from a Project Add-in.

Applies to

Scenario

As a Project/Program/Portfolio portfolio manager, I would like to use an app that displays the projects and allows me create, update and delete projects.

Using App
  1. Update the PWA site in the Project-Add-in-REST-OData-BasicDataOperations Project
  2. Update the login/password to your PWA site.
  3. Run the app
Prerequisites

To use this code sample, you need the following:

How the sample affects your tenant data

This sample runs CSOM methods that create, edit the project name and delete projects in the PWA instance for the specified user.

Additional resources
Copyright

Copyright (c) 2016 Microsoft. All rights reserved.


Prerequisites

This sample requires the following:

Description of the code

The code that uses the REST APIs is located in the Default.aspx.cs file of the SharePoint-Add-in-REST-OData-BasicDataOperationsWeb project. The Default.aspx page of the add-in appears after you install and launch the add-in and looks similar to the following.

The add-in start page with a table listing all the list on the site by name and ID.

The sample demonstrates the following:

To use the sample
  1. Open Visual Studio as an administrator.
  2. Open the .sln file.
  3. In Solution Explorer, highlight the SharePoint add-in project and replace the Site URL property with the URL of your SharePoint developer site.
  4. Press F5.
  5. After the add-in installs, the consent page opens. Click Trust It.
  6. Enter a string in the text box beside the Add List button and click the button. In a moment, the page refreshes and the new list is in the table.
  7. Click the ID of the list, and then click Retrieve List Items. There will initially be no items on the list. Some additional buttons will appear.
  8. Add a string to the text box beside the Add Item button and press the button. The new item will appear in the table in the row for the list.
  9. Add a string to the text box beside the Change List Title button and press the button. The title will change in the table.
  10. Press the Delete the List button and the list is deleted.

Do not delete any of the built-in SharePoint lists. If you mistakenly do so, recover the list from the SharePoint Recycle Bin.

Troubleshooting
Problem Solution
Visual Studio does not open the browser after you press the F5 key. Set the SharePoint Add-in 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.

Questions and comments

We'd love to get your feedback on this sample. You can send your questions and suggestions to us in the Issues section of this repository.

Additional resources

Get to know the SharePoint 2013 REST service.

Open Data Protocol

OData: JavaScript Object Notation (JSON) Format

OData: AtomPub Format.

Copyright

Copyright (c) Microsoft. All rights reserved.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.