public CamlQryIntegrationMetadata GetCamlQueryIntegratedMetadata()
 {
     if (!CheckValidArguments())
     {
         return null;
     }
     var result = new CamlQryIntegrationMetadata
     {
         Query = new CamlQuery {ViewXml = GetCamlQueryXml()}
     };
     var itemsPosition = new ListItemCollectionPosition
     {
         PagingInfo = CurrentPageInformation.Query
     };
     result.Query.ListItemCollectionPosition = itemsPosition;
     result.PagingIntegrationMetadata = CurrentPagingIntegrationMetadata;
     result.IntegrateToCamlQrExAction = IntegrateToCamlQrEx;
     return result;
 }
 public void IntegrateToCamlQrEx(CamlQryIntegrationMetadata metadata)
 {
     CurrentPageInformation.Query = metadata.PagingInformation;
     PagingNavigationSetting.UpdatePageInformation(CurrentPageInformation);
     metadata.PagingIntegrationMetadata.Status = PagingStatus.Idle;
     CurrentPagingIntegrationMetadata = metadata.PagingIntegrationMetadata;
     if (ProcessFromCamlQueryEx != null)
     {
         ProcessFromCamlQueryEx.Invoke(metadata.PagingIntegrationMetadata);
     }
 }
        public static object GetLibraryMetadata(Type libraryType, string webFullUrl, string libraryTitle,
            CamlQryIntegrationMetadata camlQryIntegrationMetadata)
        {
            if (string.IsNullOrEmpty(webFullUrl) || string.IsNullOrEmpty(libraryTitle)) return null;

            var context = new ClientContext(webFullUrl);

            context.Credentials = CredentialCache.DefaultNetworkCredentials;

            var web = context.Web;
            var list = context.Web.Lists.GetByTitle(libraryTitle);

            // Obtain selection for web metadata
            context.Load(web);
            context.Load(list, includes => includes.ItemCount);

            // Get selected fields of items
            var listItemCollection = list.GetItems(camlQryIntegrationMetadata.Query);
            context.Load(listItemCollection);

            context.ExecuteQuery();

            camlQryIntegrationMetadata.PagingInformation = listItemCollection.ListItemCollectionPosition == null
                ? string.Empty
                : listItemCollection.ListItemCollectionPosition.PagingInfo;

            camlQryIntegrationMetadata.IntegrateToCamlQrExAction.Invoke(camlQryIntegrationMetadata);

            var result = PropertiesMapper(web, list, listItemCollection, libraryType);
            return result;
        }