ASP.NET, CMS, SharePoint, UI Development

Sharepoint with REST

What is SharePoint ? 

Microsoft SharePoint is a popular business platform that supports a wide variety of projects, from simple document management solutions to networking portals and Internet sites.

MS SharePoint includes several products, including SharePoint Foundation, SharePoint Online for Web functionality, SharePoint Server, SharePoint Designer and SharePoint Workspace; the additional SharePoint modules offer their own features for site or network design.

MS SharePoint has traditionally been used as a document management tool or content management system (CMS), or to set up a business intranet. Now, as more advanced technologies offer additional benefits to companies, many of these, like specific enterprise resource planning tools and customer relationship management (CRM) interfaces, are SharePoint compatible, so that they can be added to a legacy SharePoint system.

 

What is REST API?

A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.

A RESTful API — also referred to as a RESTful web service — is based on representational state transfer (REST) technology, an architectural style and approach to communications often used in web services development.

 

Working  of RestAPI with Sharepoint :

To use the REST capabilities that are built into SharePoint, you construct a RESTful HTTP request by using the OData standard, which corresponds to the client object model API you want to use. The client.svc web service handles the HTTP request and serves the appropriate response in JSON format. The client application must then parse that response.

The endpoints in the SharePoint REST service correspond to the types and members in the SharePoint client object models. By using HTTP requests, you can use these REST endpoints to perform typical CRUD operations against SharePoint entities, such as lists and sites.

 

Architecture of Sharepoint Rest Service  :

 

 

 HTTP commands with Sharepoint Rest Service :

To perform various CRUD operations we use the following HTTP commands :

  1. GET : To read a resource
  1. POST : Create or update a resource
  1. PUT : Insert or update a resource
  1. DELETE : Delete a resource

 

CRUD Operations : 

To begin with, we will first create a sample list in SharePoint. In my example, I have created “RestAPI_SPListDemo” on which various operations will be performed.

 

In the next step we will create a document library where our html file will be stored. In my example, I have stored the html code in an file “demoCode”.

In the next step we will create a page in the sharepoint site (PracticeDetailsDemoand insert a Content Editor Web Part (CEWP) into the page. After inserting, edit the properties of the CEWP by providing the “Content Link” as the link to the text file, having html code. 

 

 

The output of this html file will be rendered by the Content Editor Web Part and will be displayed on the page.

The first table shows the data that is in the SharePoint list “RestAPI_SPListDemo” and the other sections can be used to perform necessary operations such as insertion, deletion etc. 

INSERT OPERATION :

UPDATE OPERATION :

DELETE OPERATION :

About The Author

Leave a Reply

*