/// <summary> /// Downloads the set of projects in the site /// </summary> /// <param name="onlineLogin"></param> /// <returns></returns> private DownloadProjectsList Execute_DownloadProjectsList(TableauServerSignIn onlineLogin) { var onlineUrls = _onlineUrls; _statusLog.AddStatusHeader("Request site projects"); DownloadProjectsList projects = null; //=================================================================================== //Projects... //=================================================================================== try { projects = new DownloadProjectsList(onlineUrls, onlineLogin); projects.ExecuteRequest(); //List all the projects foreach (var singleProject in projects.Projects) { _statusLog.AddStatus(singleProject.ToString()); } } catch (Exception ex) { _statusLog.AddError("Error during projects query, " + ex.ToString()); } //Store it _downloadedList_Projects = projects.Projects; return(projects); }
public void DownloadWorkbooksTest() { var url = new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9); var signIn = new TableauServerSignIn( url, "public", "tableau1user%", new TaskStatusLogs()); signIn.ExecuteRequest(); var a = new DownloadWorkbooksList(url, signIn); a.ExecuteRequest(); Assert.AreEqual(2, a.Workbooks.Count); var b = new DownloadProjectsList(url, signIn); b.ExecuteRequest(); Assert.AreEqual(1, b.Projects.Count()); signIn = new TableauServerSignIn( new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9), "tableauAdmin", "ta1user%", new TaskStatusLogs()); signIn.ExecuteRequest(); a = new DownloadWorkbooksList( new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9), signIn); a.ExecuteRequest(); Assert.AreEqual(4, a.Workbooks.Count); foreach (var workbook in a.Workbooks) { var viewQuery = new DownloadViewsForWorkbookList(workbook.Id, url, signIn); viewQuery.ExecuteRequest(); Assert.AreEqual(1, viewQuery.Views.Count); foreach (var view in viewQuery.Views) { var thumbnailQuery = new DownloadView(url, signIn); var result = thumbnailQuery.GetPreviewImage(workbook.Id, view.Id); Assert.AreNotEqual(0, result.Length); } } b = new DownloadProjectsList(url, signIn); b.ExecuteRequest(); Assert.AreEqual(1, b.Projects.Count()); var siteViews = new DownloadViewsForSiteList(url, signIn); siteViews.ExecuteRequest(); Assert.AreEqual(0, siteViews.Views.Count); }
// private readonly /// <summary> /// Constructor /// </summary> /// <param name="onlineUrls"></param> /// <param name="login"></param> public ProjectFindCreateHelper( TableauServerUrls onlineUrls, TableauServerSignIn login, IHttpClientFactory httpClientFactory) : base(onlineUrls, login, httpClientFactory) { //Ask server for the list of projects var projectsList = new DownloadProjectsList(Urls, Login, httpClientFactory); projectsList.ExecuteRequest(); ProjectsList = projectsList; }
// private readonly /// <summary> /// Constructor /// </summary> /// <param name="onlineUrls"></param> /// <param name="login"></param> public ProjectFindCreateHelper( TableauServerUrls onlineUrls, TableauServerSignIn login, UploadBehaviorProjects uploadProjectBehavior) : base(login) { _onlineUrls = onlineUrls; _uploadProjectBehavior = uploadProjectBehavior; //Ask server for the list of projects var projectsList = new DownloadProjectsList(_onlineUrls, _onlineSession); projectsList.ExecuteRequest(); _projectsList = projectsList; }
/// <summary> /// Perform the background task /// </summary> protected override void PerformKeepAliveTask() { //If we are no longer signed in, then abort the background work if(!_signIn.IsSignedIn) { this.ExitAsync(); //Tell the thread to quit } var statusLog = _signIn.StatusLog; statusLog.AddStatusHeader("Performing keep alive web request"); try { //Try to download the projects list var downloadProjectsList = new DownloadProjectsList(_serverUrls, _signIn); downloadProjectsList.ExecuteRequest(); } catch(Exception exRunningError) { statusLog.AddError("Error running keep alive work: " + exRunningError.Message); } }
/// <summary> /// Perform the background task /// </summary> protected override void PerformKeepAliveTask() { //If we are no longer signed in, then abort the background work if (!_signIn.IsSignedIn) { this.ExitAsync(); //Tell the thread to quit } var statusLog = _signIn.StatusLog; statusLog.AddStatusHeader("Performing keep alive web request"); try { //Try to download the projects list var downloadProjectsList = new DownloadProjectsList(_serverUrls, _signIn); downloadProjectsList.ExecuteRequest(); } catch (Exception exRunningError) { statusLog.AddError("Error running keep alive work: " + exRunningError.Message); } }
/// <summary> /// Downloads the set of projects in the site /// </summary> /// <param name="onlineLogin"></param> /// <returns></returns> private DownloadProjectsList Execute_DownloadProjectsList(TableauServerSignIn onlineLogin) { var onlineUrls = _onlineUrls; _statusLog.AddStatusHeader("Request site projects"); DownloadProjectsList projects = null; //=================================================================================== //Projects... //=================================================================================== try { projects = new DownloadProjectsList(onlineUrls, onlineLogin); projects.ExecuteRequest(); //List all the projects foreach (var singleProject in projects.Projects) { _statusLog.AddStatus(singleProject.ToString()); } } catch (Exception ex) { _statusLog.AddError("Error during projects query, " + ex.ToString()); } //Store it _downloadedList_Projects = projects.Projects; return projects; }