ClientContext clientContext = new SP.ClientContext.get_current();
List docLib = clientContext.Web.Lists.GetByTitle(<LIBRARY NAME>);
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='FSObjType' />"
+ "<Value Type='Integer'>1</Value></Eq></Where></Query></View>";
ListItemCollection items = docLib.GetItems(camlQuery);
clientContext.Load(items);
clientContext.ExecuteQuery();
foreach (var item in items)
{
items.GetById(item.Id).DeleteObject();
clientContext.ExecuteQuery();
}
List docLib = clientContext.Web.Lists.GetByTitle(<LIBRARY NAME>);
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='FSObjType' />"
+ "<Value Type='Integer'>1</Value></Eq></Where></Query></View>";
ListItemCollection items = docLib.GetItems(camlQuery);
clientContext.Load(items);
clientContext.ExecuteQuery();
foreach (var item in items)
{
items.GetById(item.Id).DeleteObject();
clientContext.ExecuteQuery();
}
No comments:
Post a Comment