Hi @Yichen Name
Per my test, we are unable to get items from a deleted folder. As a workaround, I will recommend you to use ChangeQuery to get deleted items from a list. Please refer to following code
ctx.Credentials = new SharePointOnlineCredentials(userName, securePassword);
Web oweb = ctx.Web;
ListCollection lists = oweb.Lists;
List targetList = lists.GetByTitle("Coding");
//ChangeQuery helps the method gets the changes by setting appropriate property as true
ChangeQuery cq = new ChangeQuery();
cq.Item = true;
//cq.Add = true;
//cq.Update = true;
cq.DeleteObject = true;
ChangeCollection cc = targetList.GetChanges(cq);
ctx.Load(cc);
ctx.ExecuteQuery();
Console.WriteLine(cc.Count.ToString());
foreach (Change change in cc)
{
if (change is Microsoft.SharePoint.Client.ChangeItem)
{
ChangeItem ci = change as ChangeItem;
ChangeType changeType = ci.ChangeType;
var itemId = ci.ItemId.ToString();
Console.WriteLine("{0}: {1}", itemId, changeType);
}
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.