// Token: 0x0600223B RID: 8763 RVA: 0x0007E7A4 File Offset: 0x0007C9A4
        internal IEnumerable <IListItem> GetItems(UserContext userContext, string endPointUrl, string documentLibrary, string location, IndexedPageView requestedData, AttachmentItemsSort sort, out int totalItemCount, DataProviderCallLogEvent logEvent)
        {
            IEnumerable <IListItem> result;

            using (IClientContext clientContext = OneDriveProUtilities.CreateAndConfigureClientContext(userContext.LogonIdentity, endPointUrl))
            {
                totalItemCount = 0;
                IList documentsLibrary             = OneDriveProUtilities.GetDocumentsLibrary(clientContext, documentLibrary);
                OneDriveProItemsPage page          = this.UpdatePageCache(clientContext, userContext, documentsLibrary, documentLibrary, location, requestedData, sort, logEvent);
                CamlQuery            camlDataQuery = this.GetCamlDataQuery(location, requestedData, this.GetListItemCollectionPosition(page), sort);
                IListItemCollection  items         = documentsLibrary.GetItems(camlDataQuery);
                IFolder folder = string.IsNullOrEmpty(location) ? documentsLibrary.RootFolder : clientContext.Web.GetFolderByServerRelativeUrl(location);
                items.Load(clientContext, new Expression <Func <ListItemCollection, object> > [0]);
                folder.Load(clientContext, new Expression <Func <Folder, object> >[]
                {
                    (Folder x) => (object)x.ItemCount
                });
                OneDriveProUtilities.ExecuteQueryWithTraces(userContext, clientContext, logEvent, "GetItems");
                int startIndex = requestedData.Offset % 200;
                int endIndex   = startIndex + requestedData.MaxRows;
                totalItemCount = folder.ItemCount;
                result         = items.ToList <IListItem>().Where((IListItem item, int index) => index >= startIndex && index < endIndex);
            }
            return(result);
        }
        // Token: 0x0600223D RID: 8765 RVA: 0x0007E938 File Offset: 0x0007CB38
        private OneDriveProItemsPage UpdatePageCache(IClientContext clientContext, UserContext userContext, IList list, string listName, string location, IndexedPageView requestedData, AttachmentItemsSort sort, DataProviderCallLogEvent logEvent)
        {
            string changeToken;
            bool   flag;

            this.GetListItemChangesSinceToken(clientContext, userContext.LogonIdentity, listName, location, out changeToken, out flag, logEvent);
            this.ChangeToken = changeToken;
            if (flag)
            {
                this.PageMap.Clear();
            }
            int num = this.ComputeStartPageIndex(requestedData);
            OneDriveProItemsPage nearestPage = this.GetNearestPage(num);
            int num2 = (nearestPage != null) ? nearestPage.PageIndex : -1;

            if (nearestPage == null || num != nearestPage.PageIndex)
            {
                ListItemCollectionPosition listItemCollectionPosition = this.GetListItemCollectionPosition(nearestPage);
                CamlQuery           query = OneDriveProUtilities.CreatePagedCamlPageQuery(location, sort, listItemCollectionPosition, Math.Abs(num - num2) * 200 + 200);
                IListItemCollection items = list.GetItems(query);
                items.Load(clientContext, new Expression <Func <ListItemCollection, object> > [0]);
                OneDriveProUtilities.ExecuteQueryWithTraces(userContext, clientContext, logEvent, "UpdatePageCache");
                this.UpdateCache(items, nearestPage);
            }
            OneDriveProItemsPage result;

            this.PageMap.TryGetValue(num, out result);
            return(result);
        }
        // Token: 0x06002241 RID: 8769 RVA: 0x0007EC40 File Offset: 0x0007CE40
        private void UpdateCache(IListItemCollection itemCollection, OneDriveProItemsPage page)
        {
            int num = (page == null) ? -1 : page.PageIndex;

            for (int i = 199; i < itemCollection.Count(); i += 200)
            {
                IListItem item = itemCollection[i];
                int       num2 = i / 200 + num + 1;
                this.PageMap[num2] = new OneDriveProItemsPage(num2, item);
            }
        }
示例#4
0
        public List <MyTestListItem> GetMyItems()
        {
            IList list = Context.Web.Lists.GetByTitle(ListTitle);
            IListItemCollection collection = list.Items;

            List <MyTestListItem> result = new List <MyTestListItem>();

            foreach (IListItem item in collection)
            {
                result.Add(new MyTestListItem()
                {
                    Id       = item.Id,
                    Modified = (DateTime)item["Modified"],
                    Title    = item.Title
                });
            }

            return(result);
        }