public ItemLista getById(Guid guidList, int idItem)
        {
            var list     = _context.Web.Lists.GetById(guidList);
            var listItem = list.GetItemById(idItem);

            _context.Load(list);
            _context.Load(listItem, i => i.DisplayName, i => i.FileSystemObjectType, i => i.Id, i => i.File, i => i.AttachmentFiles);
            _context.ExecuteQuery();

            return(ItemListaMapper.Map(listItem));
        }
Пример #2
0
        public List <ItemLista> getAllItemsById(Guid guid)
        {
            var list  = _context.Web.GetListById(guid);
            var items = list.GetItems(CamlQuery.CreateAllItemsQuery());

            if (list.BaseType == BaseType.GenericList)
            {
                _context.Load(items, eachItem => eachItem.IncludeWithDefaultProperties(item => item.DisplayName, item => item.File, item => item.AttachmentFiles));
            }
            else
            {
                _context.Load(items, eachItem => eachItem.IncludeWithDefaultProperties(item => item.DisplayName, item => item.File));
            }

            _context.ExecuteQuery();
            return(ItemListaMapper.Map(items));
        }