Delete item in a SharePoint Online List

Trying to use UIPath to delete items in a SharePoint Online (SPO) list view. The criteria for deleting

*delete any line in the list “Temp Device” that has a date (date column is “Returned”) which is Today() -32.

After much “developing” I think i got a start but having trouble with the highlighted fields. Cannot seem to figure out how to find the correct syntax to get it done. Below is my sequence i have gotten so far. In “For Each ITem” activity i cannot get the list name , filter or the list item to resolve. Any suggestions?

Hi @Greg_Hutchins_ghutchins,

Welcome to community.

Can you share the errors you get?

Regards,
MY

Hey @Greg_Hutchins_ghutchins

Don’t use double quotes in the output of Get List Info. Just get the list into a new variable please which is properly named & pass it to for each list item.

In Delete you need just pass ListItem from ForEach.

Thanks
#nK

Thank you for the solution to the ‘Delete List Item’ issue.

Apologize but I don’t know what the “output of Get List Info” or how to get it into a variable. I right clicked the activity and selected ‘Create Variable’ but that did not resolve the issue when that variable was used here.

I am getting a compiler error for ‘Filter’ - have no idea how what the syntax is to filter the ‘For Each List Item’

Just figured out the syntax for the filter…

“fields/Returned <= Today.AddDays(-32)”

Now my only problem is what the syntax is for this…

image

Hey @Greg_Hutchins_ghutchins

It should be the SharePoint list object output from the previous Get activity

Thanks
#nK

I assumed that was the case… i don’t have/know the correct syntax for that object. I have tried using variables, all variations of the list url with and without quotes and have failed in every attempt. Here is one of many errors…

Error ERROR Validation Error Compiler error(s) encountered processing expression “ListInfo”.
Reference required to assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ containing the base class ‘System.Object’. Add one to your project. Delete Items - For Each Example.xaml

If your “Get List Info” output is a Data Table variable, you can use a “Filter Data Table” to remove all rows that meet your date criteria instead of a “For Each” activity.

Thanks @ron.butler … i would like to learn how to do that someday. Right now i would like to correct these errors. I created a variable with the site URL and used it in the ‘For Each List Item’ activity. Swing and a miss…

The error you are receiving states that the variable you are using is a Data Table and that it is unable to convert it to the variable type the For Each activity is expecting. you need to use the “For Each Row in Data Table” activity instead. Or you can create an Excel file from the data table, this will allow you to see the structure of information to help you create a data Table Filter.

Okay… so what is the syntax for this field?
image

That would be the name of the Data Table variable that you assigned in the output for the “Get List Info” activity.

I am working with a SharePoint list not Excel. I need a “type” that works with SharePoint Lists. Sorry but i am new and i need to stick with SharePoint.

Your error message is saying that your Variable is defined as a Data Table, if you do not want to use a Data Table then you will need to redefine your variable as a SharePoint List variable, which I do not know how or if that variable type exists. A SharePoint List is the data you are retrieving from SharePoint the Data Table is the variable type your activity is saving to. I have attached a view of the Activity I use (outlined in red) the variable the list is saved to in my activity (outlined in green) I included the “Filter Data Table” activity (outlined in blue) as it was in my program already.
image

What I did not include was the Write activity I used that saves a Data Table as an Excel file. which I used to help me define the filter in the Filter Data Table because I removed it once I no longer needed the Excel file to help me define the filter.