How to Create and Delete an Item from a SharePoint List using Power Automate Desktop?

This Power Automate Desktop tutorial will show us how to create an item in a SharePoint list using Power Automate Desktop. Also, we will see how to delete an item from the SharePoint list using Power Automate Desktop.

Now, let’s see an example of how to create an item in the SharePoint list using Power Automate Desktop.

For example, in Power Automate Desktop, we have a custom form that contains the below columns and collects the information related to the product:

  • Id-Text
  • Name- Text
  • Description-Text(Multi-line)
  • Price-Number
  • Quantity-Number
  • Testimonial-File type
MS Power automate Desktop delete item in SharePoint Online list

Once we fill out the form and click the Submit button, the item is created in the Product Details SharePoint list. Also, we will add the attachment to that particular item.

So, this SharePoint list ‘Product Details’ contains the below columns:

  • Title-Single line of text
  • Name- Single line of text
  • Description-Multiple lines of text
  • Price- Currency
  • Quantity- Number
Power automate Desktop create item in SharePoint list

Create an item in a SharePoint list using Power Automate Desktop

Here, we will see how to create an item in the SharePoint list using Power Automate Desktop.

Before creating the desktop flow, set the SharePoint Online List with the above-defined columns.

Step 1: Open Power Automate Desktop, provide the Flow name, and click the Create button.

How to create item in SharePoint Online list using MS Power automate Desktop

Step 2: We will create a custom form in Power Automate Desktop. For this, expand the Display message section, drag and drop the Display Custom form action, and then provide the below information:

  • Select the Custom Form Designer button.
Microsoft Power automate Desktop create item in SharePoint Online list

Then provide the Form name on the right-hand side under the Title section.

  • Next, we will create the First field i.e. Id field, so, drag and drop the Text field to the designer area.
  • Then on the right side provide the field name and label that will be displayed in the form.
MS Power automate Desktop create item in SharePoint list

Similarly, add the rest of the field i.e. Name, Description, Price, and Quantity field. Drag and drop the File Input Field to the Designer area to add the Testimonial field.

See also  How to Create Calendar Events from a SharePoint list using Power Automate?

Now, you can change the Field name and Label on the right-hand side of the window. Now you can preview the Form after adding the fields to the form. It looks like below:

Using Power automate Desktop create item in SharePoint Online list

Next, we will add the Submit button so we can submit the form and add the output data. For this drag and drop the Submit action, then provide the ID as Submit and Title as Done.

Power automate desktop create item in SharePoint list

Step 3: Now, we will create an item in the SharePoint list; for this, drag and drop the Create Item action. Then provide the below information:

  • Site address: Select SharePoint site address.
  • List name: Select the List name as Product Details
  • Title:
%CustomFormData.Id%
  • Name:
%CustomFormData.Name%
  • Description:
%CustomFormData.Description%
  • Price:
%CustomFormData.Price%
  • Quantity:
%CustomFormData.Quantity%
Using MS Power automate Desktop create item in SharePoint Online list

Step 4: We need to convert the file to binary to add attachments to the SharePoint list item. Drag and drop the ‘Convert File to binary’ action for this. Then provide the below information:

  • File path: Provide the below argument:
%CustomFormData.Testimonial%
Using Microsoft Power automate Desktop create item in SharePoint Online list

Step 5: Now, we will add an attachment to the SharePoint list; for this, drag and drop the Add attachment action to the canvas. Then provide the below information:

  • Site address: Select the SharePoint site address
  • List name: Provide the list name
  • Id: Provide the below argument
%PostItemResponse.ID%
  • File name: Provide the file name.
  • File content: Click on variable icon {x}, select the ‘Binary Data’ variable, and click on Select.
Using Microsoft Power automate Desktop create item in SharePoint list

Step 6: Now run the flow by clicking on the run button. Fill out the form and click on the ‘Done’ button. Once the flow runs successfully, you can see the item added successfully to the SharePoint list.

Power automate Desktop create item in SharePoint Online list

This is how to create items in the SharePoint list using Power Automate Desktop.

See also  When an item is created in SharePoint list send approval and create item using Power Automate

Delete an item from the SharePoint list using Power Automate Desktop

Here, we will see how to delete an item from the SharePoint list using Power Automate Desktop.

For this example, i will use the same Product Details SharePoint list, and I will create a desktop flow that will get all the items from the SharePoint list and check the quantity of the item. If the quantity is equal to 0, then we will delete the item from the SharePoint list.

Power automate Desktop delete item in SharePoint Online list

Step 1: Open Power Automate Desktop, click on the +New flow -> then provide the flow name and click on the Create button.

How to delete item in SharePoint Online list using MS Power automate Desktop

Step 2: We will get items from the SharePoint list using Power Automate Desktop. For this, drag and drop the ‘Get items’ action. Then provide the below information:

  • Site address: Select the Site address from the dropdown.
  • List name: Select the list name from the drop-down.
Using Microsoft Power automate Desktop delete item in SharePoint Online list

Step 3: We will parse the JSON output of the last step, so drag and drop the ‘Convert JSON to custom object’ action to canvas. Then provide the below information:

  • JSON: Click on the variable icon {x}, and select the ‘GetItemResponse’ variable.
Using MS Power automate Desktop delete item in SharePoint Online list

Step 4: Now, we will loop through the SharePoint items from the list. So drag and drop the ‘For each’ action to the canvas. Then provide the below information:

  • Value to iterate: Provide the below argument:
%JsonAsCustomObject.value%
Using MS Power automate Desktop delete item in SharePoint list

Step 5: Next, we will check that the Quantity is equal to 0, then delete that particular item. For this drag and drop the IF condition action to canvas. Then provide the below information:

  • First Operand: Provide the first operand as:
%CurrentItem.Quantity%
  • Operator: Select the operator as ‘equal to’ from the options.
  • Second Operand: Provide the Second operand as 0.
Using Power automate Desktop delete item in SharePoint Online list

Step 6: Now we will delete items in the SharePoint list, for this, drag and drop the Delete item action to canvas. Then provide the below information:

  • Site address: Select the SharePoint site address
  • List name: Select the list name from dropdown
  • Id: Provide the Id as below argument:
%CurrentItem.ID%
Using Microsoft Power automate Desktop delete item in SharePoint list

Step 7: Now run the flow by clicking on the run button. Once the flow runs successfully, you can see the item is deleted whose quantity =0.

Microsoft Power automate Desktop delete item in SharePoint Online list

This is how to delete a SharePoint list item using Power Automate Desktop.

See also  How to Add Rows to Excel in Power Automate?

Conclusion

In this Power Automate Desktop tutorial, we saw how to create an item in a SharePoint list using Power Automate Desktop. Also, we saw how to delete items from a SharePoint list using Power Automate Desktop.

You may also like the following tutorials:

>