Пример #1
0
        public void Delete(string formData)
        {
            var       list        = GetList();
            var       camlUtility = new CamlUtility <T>();
            CamlQuery camlQuery   = new CamlQuery();

            camlQuery.ViewXml = camlUtility.GenerateFromQueryString(formData);
            var listItems = list.GetItems(camlQuery);

            ClientContext.Load(listItems);
            ClientContext.ExecuteQuery();
            foreach (var item in listItems.ToList())
            {
                item.DeleteObject();
            }
            ClientContext.ExecuteQuery();
        }
Пример #2
0
        public async Task <List <T> > Query(string queryString)
        {
            var       itemList    = new List <T>();
            var       list        = ClientContext.Web.Lists.GetByTitle(ListName);
            var       camlUtility = new CamlUtility <T>();
            CamlQuery camlQuery   = new CamlQuery();

            camlQuery.ViewXml = camlUtility.GenerateFromQueryString(queryString);
            var listItems = list.GetItems(camlQuery);

            ClientContext.RequestTimeout = -1;
            ClientContext.Load(listItems);
            ClientContext.ExecuteQuery();
            foreach (var item in listItems)
            {
                itemList.Add(await PopulateSEntity(item));
            }
            return(itemList);
        }