First here I am getting the total records in the list, then if the count is greater then 4990 then I am getting the first 100 records, then looping each record for deletion. So I will not get list threshhold problem for that view. Here I am using Sharepoint client object model to perform this operations for Sharepoint online.
I think this same code will work for onpremise also. Sharepoint online is more secure for login from client object model. So for logging into Sharepoint online it will not accept direct password. We need to convert our password as secure string, only then can we connect to Sharepoint online and we can work.
So here I am using GetPasswordFromConsoleInput() function for converting my login password to convert as secure string and then am passing this secure string to SharePointOnlineCredentials() method. Here I used console application to do this task.
So to work with CSOM we need to install Sharepoint client in our system.
We need to add reference dlls in our console application.
We need to add sharepoint.client.dll and sharepoint.client.runtime.dll files.

Join the conversation! Your thoughts help the community grow.