Пример #1
0
        private void ExecuteRequestForPage(List <TableauReportVisual> views, int pageToRequest, out int totalNumberPages)
        {
            int pageSize = urls.PageSize;
            //Create a web request, in including the users logged-in auth information in the request headers
            var urlQuery   = urls.UrlDownloadViewsForSite(Login, pageSize, pageToRequest);
            var webRequest = CreateLoggedInRequest(urlQuery, HttpMethod.Get);

            Login.Logger.Information("Web request: " + urlQuery);
            var response = SendHttpRequest(webRequest);
            var xmlDoc   = GetHttpResponseAsXml(response);

            //Get all the view nodes
            var xDoc         = xmlDoc.ToXDocument();
            var viewElements = xDoc.Root.Descendants(XName.Get("view", xmlNamespace));

            //Get information for each of the data sources
            foreach (var element in viewElements)
            {
                var view = ParseSiteXElement(element);
                views.Add(view);
            } //end: foreach

            //-------------------------------------------------------------------
            //Get the updated page-count
            //-------------------------------------------------------------------

            var paginationElement = xDoc.Root.Descendants(XName.Get("pagination", xmlNamespace)).FirstOrDefault();

            totalNumberPages = GetPageCount(paginationElement, pageSize);
        }