Url_ProjectsList() public méthode

URL for the Projects list
public Url_ProjectsList ( TableauServerSignIn, session, int pageSize, int pageNumber = 1 ) : string
session TableauServerSignIn,
pageSize int
pageNumber int
Résultat string
Exemple #1
0
    /// <summary>
    /// Get a page's worth of Projects listing
    /// </summary>
    /// <param name="onlineProjects"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteProject> onlineProjects, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
        var urlQuery = _onlineUrls.Url_ProjectsList(_onlineSession, pageSize, pageToRequest);

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        XmlDocument xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get projects list");
        //var webRequest = CreateLoggedInWebRequest(urlQuery);
        //webRequest.Method = "GET";
        //var response = GetWebReponseLogErrors(webRequest, "get projects list");
        //var xmlDoc = GetWebResponseAsXml(response);

        //Get all the project nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var projects  = xmlDoc.SelectNodes("//iwsOnline:project", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in projects)
        {
            try
            {
                var proj = new SiteProject(itemXml);
                onlineProjects.Add(proj);

                SanityCheckProject(proj, itemXml);
            }
            catch
            {
                AppDiagnostics.Assert(false, "Project parse error");
                _onlineSession.StatusLog.AddError("Error parsing project: " + itemXml.OuterXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }