In this article, we will discuss how to remove a file from a document library in a SharePoint List using REST API.
IntroductionWelcome to the SharePoint 2013 REST Series. In my previous article, we have seen how to remove attachment from list item in SharePoint 2013 REST API.In this article, we will discuss how to remove a file from a Document Library in a SharePoint List using the REST API.SharePoint 2013 environment adds the ability for you to remotely interact with SharePoint sites by using REST. So you can talk to SharePoint objects by using any technology that supports standard REST capabilities. In this way, SharePoint data can be accessed anywhere and everywhere.List of REST Access PointsThe following is a list of access points that gives you entry into granular access points.
List of REST End Points The following is a list of endpoints that are the most commonly used in a SharePoint list.
Note: The following code is tested in my SP 2013 online environment.Step 1: Before writing your code, please ensure you have sufficient permission to access cross-domain requests. So I have given full permission to all the contents listed below.
Tenant
Full Permission
Site Collection
Web
List
ScreenshotStep 3: When deploying, you will be prompted with the following screen. Press Trust it and proceed with the deployment.Code WalkthroughA. Post Method in REST APISharePoint 2013 REST service supports sending POST commands that include object definitions to endpoints that represent collections. In this example, Test List is a custom SharePoint list where list items are updated.B. Request Executor.JSThe cross-domain library lets you interact with more than one domain in your remote app page through a proxy. SP.RequestExecutor.js acts as a cross-domain library to fetch or create a SharePoint list from your APP domain.
SummaryI hope this article helps you.
Interview Questions on SharePoint 2013