Currently I have a few codes running that fills some Sharepoint lists using Python in combination with Shareplum. The only thing I don't get is how to remove rows from a specific list. I want to do this using Python, because any list with a lot of items in Sharepoint doesn't fully load straight away and select all only picks a few rows.
On the documentation site of SharePlum i found this: As a result I tried two options with no results:
......
#Login to Sharepoint
sp_list = site.List('Name of list')
sp_data = sp_list.GetListItems('All Items')
#Option 1:
sp_list.UpdateListItems(data=sp_data, kind='Delete')
#Option 2:
lengte = [i for i in range(1, len(sp_data))]
sp_list.UpdateListItems(data=lengte, kind='Delete')
Both ran without an error and I was able to print the sp_list correctly, but nothing happend on the Sharepoint list. Hopefully someone has encountered this before?
I am using Shareplum package and passing list item IDs to the updatelistitems function for deleting records from SharePoint List. Note that the below code works only if the total number of list items is less than or equal to 5000.