In this article, we have demonstrated how you can perform Create, Read, Update and Delete (CRUD) operations on SharePoint List item using REST-API (Send an HTTP request to SharePoint) call and also using MS Flow SharePoint connectors.
MS Flow – REST API: Read Operation
- Step 1: Enter the triggering action. We will trigger the flow Manually. You can set the trigger as per your requirement
- Step 2: After that, add an action - Send an HTTP request to SharePoint
- You need to add
- Site Address – Enter your site URL
- Method – GET
- Uri – You need to add the REST API endpoint over here
- Step 3: In this step, we will parse the response that we got from the earlier action. Add action Parse JSON
- Step 4: We will add an action where we can utilize the parsed value in the above step. You can add the action as per your requirement. We have added Send an Email action here.
- To and Subject are self-explanatory fields.
- In the Body section, you can utilize the fields that you have parsed in the above step.
MS Flow – SharePoint: Get item / Get file properties
- Enter the trigger. Here again, we will consider manual trigger.
- Add one action called Get item.
- Here, you need to specify Site Address, List Name, and Id of the item.
- You can use this action only on SharePoint List. For Document Library you will have to use action – SharePoint: Get file properties.
- You can use item/document properties in the next step as described above, we have used the Title column in the email body. You can use any column present in the item metadata.
MS Flow – REST API: Create List Item.
- We will go straight away to placing action - Send an HTTP request to SharePoint you can use this article for your reference: Create list Item using REST-API
- Site Address: Put the SharePoint site URL
- Method: specify POST over here
- Uri: This is the endpoint of our REST-API call
- Headers: Put all the necessary headers here. On the left side, you need to specify the key and on the right side, you need to specify the header value.
- Body: The actually content that you want to POST to the endpoint.
MS Flow – SharePoint: Create an item
- You can directly put Create item action from SharePoint.
- Here, you need to mention Site Address, Url, and all the properties that you want to fill while adding the list item in the list.
MS Flow – REST API: Update List Item
- placing action - Send an HTTP request to SharePoint
- You can use this article for your reference: Update list Item using REST-API
- Site Address: Put the SharePoint site URL
- Method: specify POST over here
- Uri: This is the endpoint of our REST-API call. Here, list item ID is hardcoded, you can fetch the list item Id dynamically using Get item method mentioned in the above section.
- Headers: Put all the necessary headers here. On the left side, you need to specify the key and on the right side, you need to specify the header value.
- Body: The actually content that you want to POST to the endpoint.
MS Flow – SharePoint: Update item / Update file properties
- You can directly put Update item action from SharePoint.
- Here, you need to mention Site Address, Url, and all the properties that you want to fill while updating the list item in the list.
- For Document Library you will have to use action – SharePoint: Update file properties.
MS Flow – REST API: Delete Item
MS Flow – SharePoint: Delete item / Delete file
- You can directly put Delete item action from SharePoint.
- Here, you need to mention Site Address, Url, and item id that you want to delete from the list.
- For Document Library you will have to use action – SharePoint: Delete file.
MS Flow– Delete attachment from SharePoint List item
- First, we will get all the attachments of the list item using List Item Id.
- Next step, we get multiple attachments so there will be a loop to handle each item. we will put one condition over here.
- In this action, we will put a condition to check the attachment name, and based on the attachment name we will get the Identifier and delete the attachment.
- You can see the entire flow for deleting an attachment below.