Manages the signed in session for a Tableau Server site's sign in
Inheritance: TableauServerRequestBase
Exemplo n.º 1
3
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="localUploadPath"></param>
    public UploadDatasources(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        bool attemptOwnershipAssignment,
        IEnumerable<SiteUser> siteUsers,
        int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        System.Diagnostics.Debug.Assert(uploadChunkSizeBytes > 0, "Chunck size must be positive");

        _onlineUrls = onlineUrls;
        _localUploadPath = localUploadPath;
        _uploadProjectBehavior = uploadProjectBehavior;
        _credentialManager = credentialManager;
        _manualActions = manualActions;
        if(_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }

        //If we are going to attempt to reassign ownership after publication we'll need this information
        _attemptOwnershipAssignment = attemptOwnershipAssignment;
        _siteUsers = siteUsers;

        //Test parameters
        _uploadChunkSizeBytes = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
Exemplo n.º 2
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="localUploadPath"></param>
    public UploadDatasources(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        System.Diagnostics.Debug.Assert(uploadChunkSizeBytes > 0, "Chunck size must be positive");

        _onlineUrls = onlineUrls;
        _localUploadPath = localUploadPath;
        _uploadProjectBehavior = uploadProjectBehavior;
        _credentialManager = credentialManager;
        _manualActions = manualActions;
        if(_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }
        //Test parameters
        _uploadChunkSizeBytes = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="credentialManager">Set of database credentials to attach to associated content being published</param>
 /// <param name="localUploadPath">Path to upload from</param>
 /// <param name="remapWorkbookReferences">TRUE if we want to modify the workbooks to point datasource/other references to the new server</param>
 /// <param name="localPathTempWorkspace">Path to perform local file work in</param>
 /// <param name="uploadProjectBehavior">Instructions on whether to map content into projects</param>
 /// <param name="manualActions">Any manual actions that need to be performed by the user are written here</param>
 /// <param name="uploadChunkDelaySeconds">For testing, a delay we can inject</param>
 public UploadWorkbooks(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login,
     CredentialManager credentialManager,
     string localUploadPath,
     bool remapWorkbookReferences,
     string localPathTempWorkspace,
     UploadBehaviorProjects uploadProjectBehavior,
     CustomerManualActionManager manualActions,
     int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
     int uploadChunkDelaySeconds = 0)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _localUploadPath = localUploadPath;
     _remapWorkbookReferences = remapWorkbookReferences;
     _localPathTempWorkspace = localPathTempWorkspace;
     _uploadProjectBehavior = uploadProjectBehavior;
     _manualActions = manualActions;
     _credentialManager = credentialManager; 
     if (_manualActions == null)
     {
         _manualActions = new CustomerManualActionManager();
     }
     //Test parameters
     _uploadChunkSizeBytes = uploadChunkSizeBytes;
     _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
 }
Exemplo n.º 4
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="credentialManager">Set of database credentials to attach to associated content being published</param>
    /// <param name="localUploadPath">Path to upload from</param>
    /// <param name="remapWorkbookReferences">TRUE if we want to modify the workbooks to point datasource/other references to the new server</param>
    /// <param name="localPathTempWorkspace">Path to perform local file work in</param>
    /// <param name="uploadProjectBehavior">Instructions on whether to map content into projects</param>
    /// <param name="manualActions">Any manual actions that need to be performed by the user are written here</param>
    /// <param name="attemptOwnershipAssignment">TRUE: After upload attempt to reassign the ownership of the content based on local metadata we have</param>
    /// <param name="siteUsers">List of users to perform ownership assignement with</param>
    /// <param name="uploadChunkDelaySeconds">For testing, a delay we can inject</param>
    public UploadWorkbooks(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        CredentialManager credentialManager,
        string localUploadPath,
        bool remapWorkbookReferences,
        string localPathTempWorkspace,
        UploadBehaviorProjects uploadProjectBehavior,
        CustomerManualActionManager manualActions,
        bool attemptOwnershipAssignment,
        IEnumerable<SiteUser> siteUsers,
        int uploadChunkSizeBytes = TableauServerUrls.UploadFileChunkSize,
        int uploadChunkDelaySeconds = 0)
        : base(login)
    {
        _onlineUrls = onlineUrls;
        _localUploadPath = localUploadPath;
        _remapWorkbookReferences = remapWorkbookReferences;
        _localPathTempWorkspace = localPathTempWorkspace;
        _uploadProjectBehavior = uploadProjectBehavior;
        _manualActions = manualActions;
        _credentialManager = credentialManager;
        if (_manualActions == null)
        {
            _manualActions = new CustomerManualActionManager();
        }

        //If we are going to attempt to reassign ownership after publication we'll need this information
        _attemptOwnershipAssignment = attemptOwnershipAssignment;
        _siteUsers = siteUsers;

        //Test parameters
        _uploadChunkSizeBytes = uploadChunkSizeBytes;
        _uploadChunkDelaySeconds = uploadChunkDelaySeconds;
    }
Exemplo n.º 5
0
 public SendCreateProject(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login,
     string projectName)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _projectName = projectName;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="workbookId">GUID</param>
 /// <param name="newOwnerId">GUID</param>
 public SendUpdateWorkbookOwner(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login,
     string workbookId,
     string newOwnerId)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _workbookId = workbookId;
     _newOwnerId = newOwnerId;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="datasourceId">GUID</param>
 /// <param name="newOwnerId">GUID</param>
 public SendUpdateDatasourceOwner(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login,
     string datasourceId,
     string newOwnerId)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _datasourceId = datasourceId;
     _newOwnerId = newOwnerId;
 }
Exemplo n.º 8
0
    /// <summary>
    /// Synchronous call to test and make sure sign in works
    /// </summary>
    /// <param name="url"></param>
    /// <param name="userId"></param>
    /// <param name="userPassword"></param>
    /// <param name="statusLog"></param>
    public static void VerifySignInPossible(string url, string userId, string userPassword, TaskStatusLogs statusLog)
    {
        var urlManager = TableauServerUrls.FromContentUrl(url, TaskMasterOptions.RestApiReponsePageSizeDefault);
        var signIn = new TableauServerSignIn(urlManager, userId, userPassword, statusLog);
        bool success = signIn.ExecuteRequest();

        if(!success)
        {
            throw new Exception("Failed sign in");
        }
    }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="Datasources"></param>
 /// <param name="localSavePath"></param>
 /// <param name="projectsList"></param>
 public DownloadDatasources(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login, 
     IEnumerable<SiteDatasource> Datasources,
     string localSavePath,
     IProjectsList projectsList)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _datasources = Datasources;
     _localSavePath = localSavePath;
     _downloadToProjectDirectories = projectsList;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="workbooks"></param>
 /// <param name="localSavePath"></param>
 /// <param name="projectsList"></param>
 public DownloadWorkbooks(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login, 
     IEnumerable<SiteWorkbook> workbooks,
     string localSavePath,
     IProjectsList projectsList)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _workbooks = workbooks;
     _localSavePath = localSavePath;
     _downloadToProjectDirectories = projectsList;
 }
Exemplo n.º 11
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="localUploadPath"></param>
    /// <param name="uploadChunkSize"></param>
    /// <param name="uploadChunkDelay"></param>
    public UploadFile(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        string localUploadPath,
        int uploadChunkSize = 8000000,
        int uploadChunkDelay = 0)
        : base(login)
    {
        _onlineUrls = onlineUrls;
        _localUploadPath = localUploadPath;
        _uploadChunkSize = uploadChunkSize;
        _uploadChunkDelay = uploadChunkDelay;

    }
Exemplo n.º 12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="workbooks"></param>
 /// <param name="localSavePath"></param>
 /// <param name="projectsList"></param>
 /// <param name="generateInfoFile">TRUE = Generate companion file for each download that contains metadata (e.g. whether "show tabs" is selected, the owner, etc)</param>
 /// <param name="siteUsersLookup">If not NULL, use to look up the owners name, so we can write it into the InfoFile for the downloaded content</param>
 public DownloadWorkbooks(
     TableauServerUrls onlineUrls, 
     TableauServerSignIn login, 
     IEnumerable<SiteWorkbook> workbooks,
     string localSavePath,
     IProjectsList projectsList,
     bool generateInfoFile,
     KeyedLookup<SiteUser> siteUserLookup)
     : base(login)
 {
     _onlineUrls = onlineUrls;
     _workbooks = workbooks;
     _localSavePath = localSavePath;
     _downloadToProjectDirectories = projectsList;
     _generateInfoFile = generateInfoFile;
     _siteUserLookup = siteUserLookup;
 }
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="datasourceId"></param>
    /// <param name="tagText"></param>
    public SendDeleteDatasourceTag(
        TableauServerUrls onlineUrls, 
        TableauServerSignIn login,
        string datasourceId,
        string tagText)
        : base(login)
    {
        if(string.IsNullOrWhiteSpace(tagText))
        {
            throw new ArgumentException("Not allowed to delete a blank tag");
        }

        if (string.IsNullOrWhiteSpace(datasourceId))
        {
            throw new ArgumentException("Not allowed to delete a tag without datasource id");
        }

        _onlineUrls = onlineUrls;
        _contentId = datasourceId;
        _tagText = tagText;
    }
Exemplo n.º 14
0
    /// <summary>
    /// Called to perform Uploads of the workbooks
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="localBasePath"></param>
    /// <param name="remapWorkbookReferences">TRUE is we want to transform workbooks to remap any published datasources to the new server/site we are uploading to</param>
    /// <param name="attemptContentOwnershipAssignment">TRUE: Look for content metadata files, and attempt to assign the owner to the published content</param>
    /// <param name="credentialManager">Database credentials to associate with content we are uploading</param>
    /// <param name="siteUsers">Users in site, needed for content ownership remapping</param>
    private void Execute_UploadWorkbooks(
        TableauServerSignIn onlineLogin, 
        string localBasePath, 
        bool remapWorkbookReferences, 
        CredentialManager credentialManager,
        bool attemptContentOwnershipAssignment,
        IEnumerable<SiteUser> siteUsers)
    {
        StatusLog.AddStatusHeader("Upload workbooks");

        if (string.IsNullOrWhiteSpace(localBasePath))
        {
            _statusLog.AddError("Abort uploads. Local path is not specified");
            return;
        }

        string pathWorkbooks = Path.Combine(localBasePath, "workbooks");
        if (!Directory.Exists(pathWorkbooks))
        {
            _statusLog.AddStatus("Skipping workbooks upload. Local workbooks path does not exist: \"" + pathWorkbooks + "\"");
            return;
        }

        //Do we have a directory to perform remapping
        string pathRemappingTempspace = Path.Combine(localBasePath, "_remapTempspace");
        if (!Directory.Exists(pathRemappingTempspace))
        {
            Directory.CreateDirectory(pathRemappingTempspace);
        }

        //Upload all the files
        var uploadProjectBehavior = new UploadBehaviorProjects(
            _taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadCreateNeededProjects),
            true);

        var dsUploader = new UploadWorkbooks(
            _onlineUrls,
            onlineLogin,
            credentialManager,
            pathWorkbooks,
            remapWorkbookReferences,
            pathRemappingTempspace,
            uploadProjectBehavior,
            _manualActions,
            attemptContentOwnershipAssignment,
            siteUsers,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds
            );
        try
        {
            dsUploader.ExecuteRequest();
        }
        catch (Exception exUploader)
        {
            StatusLog.AddError("Aborted upload workbooks. Unexpected error + " + exUploader.Message);
        }
    }
Exemplo n.º 15
0
    /// <summary>
    /// URL to download a datasource
    /// </summary>
    /// <param name="siteUrlSegment"></param>
    /// <returns></returns>
    public string Url_DatasourceDownload(TableauServerSignIn session, SiteDatasource contentInfo)
    {
        string workingText = _urlDownloadDatasourceTemplate;
        workingText = workingText.Replace("{{iwsSiteId}}", session.SiteId);
        workingText = workingText.Replace("{{iwsRepositoryId}}", contentInfo.Id);

        ValidateTemplateReplaceComplete(workingText);
        return workingText;
    }
Exemplo n.º 16
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadUsersListInGroup(TableauServerSignIn login, string groupId)
     : base(login)
 {
     _groupId = groupId;
 }
Exemplo n.º 17
0
 public DownloadProjectsList(TableauServerUrls onlineUrls, TableauServerSignIn login, IHttpClientFactory httpClientFactory)
     : base(onlineUrls, login, httpClientFactory)
 {
 }
Exemplo n.º 18
0
    /// <summary>
    /// Update the provisioning status for a single unexpected user
    /// </summary>
    /// <param name="unexpectedUser"></param>
    /// <param name="siteSignIn"></param>
    private void Execute_UpdateUnexpectedUsersProvisioning_SingleUser(SiteUser unexpectedUser, TableauServerSignIn siteSignIn)
    {
        _statusLogs.AddStatus("Process unexpected user: "******"811-1123: Unknown authentication type " + unexpectedUser.SiteAuthentication + ", for user " + unexpectedUser.Name);
            _statusLogs.AddError("811-1123: Unknown authentication type " + unexpectedUser.SiteAuthentication + ", for user " + unexpectedUser.Name);
            break;
        }
    }
Exemplo n.º 19
0
 /// <summary>
 /// URL for a Datasource's connections list
 /// </summary>
 /// <param name="session"></param>
 /// <param name="datasourceId"></param>
 /// <returns></returns>
 internal string Url_DatasourceConnectionsList(TableauServerSignIn session, string datasourceId)
 {
     throw new NotImplementedException("2015-11-16, Tableau Server does not yet have a REST API to support this call");
 }
Exemplo n.º 20
0
//    private readonly OnlineUser _user;

    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    public DownloadDatasourcesList(TableauServerUrls onlineUrls, TableauServerSignIn login)
        : base(login)
    {
        _onlineUrls = onlineUrls;
//        _user = user;
    }
Exemplo n.º 21
0
    /// <summary>
    /// Perform the work
    /// </summary>
    private void ExecuteTask_InternalAllTasks()
    {
        string exportToPath = _exportToLocalPath;
        var    onlineUrls   = _onlineUrls;
        var    taskOptions  = _taskOptions;

        //========================================================================================
        //Log into Tableau Online
        //========================================================================================
        var serverLogin = new TableauServerSignIn(onlineUrls, _userName, _password, _statusLog);

        try
        {
            serverLogin.ExecuteRequest();
        }
        catch (Exception exLogin)
        {
            _statusLog.AddError("Failed loging, " + exLogin.ToString());

            _isDone = true;
            return;
        }

        //========================================================================================
        //If there is a custom command we want to execute, do it
        //========================================================================================
        var customCommand1 = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ArbitraryCommand1);

        if (!string.IsNullOrWhiteSpace(customCommand1))
        {
            AttemptExecutionOfCustomHttpGet(serverLogin, customCommand1);
        }
        var customCommand2 = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ArbitraryCommand2);

        if (!string.IsNullOrWhiteSpace(customCommand2))
        {
            AttemptExecutionOfCustomHttpGet(serverLogin, customCommand2);
        }

        //========================================================================================
        //If there is a project we want to create, then do it
        //========================================================================================
        var createProjectName = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_CreateProjectWithName);

        if (!string.IsNullOrWhiteSpace(createProjectName))
        {
            Execute_CreateProjectWithName(serverLogin, createProjectName);
        }

        //========================================================================================
        //Attempt to get the list of users
        //========================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetSiteUsers))
        {
            _downloadedList_Users = Execute_DownloadSiteUsers(serverLogin);
        }

        //========================================================================================
        //Attempt to get the site information
        //========================================================================================
        SiteinfoSite site = null;

        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetSiteInfo))
        {
            site = Execute_DownloadSiteInfo(serverLogin);
        }

        //If this gets set then we will pass the information for project/name mapping to the workbook and datasource downloaders
        IProjectsList projectNameIdMapping = null;
        SiteProject   exportSingleProject  = null; //If non NULL, then look up the project

        //===================================================================================
        //Projects List
        //===================================================================================
        if ((taskOptions.IsOptionSet(TaskMasterOptions.Option_GetProjectsList)) ||
            (taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadIntoProjects)) ||
            (taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_ExportSingleProject))
            )
        {
            var projectsList = Execute_DownloadProjectsList(serverLogin);

            if (taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadIntoProjects))
            {
                projectNameIdMapping = projectsList;
            }

            //Determine if the there is a project filter
            exportSingleProject = helper_DetermineIfSingleProjectFilter(projectsList);
        }


        //===================================================================================
        //List of groups?
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetGroupsList))
        {
            Execute_DownloadGroupsList(serverLogin);
        }

        //===================================================================================
        //List of datasources? (does not download actual data sources, just the list)
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetDatasourcesList))
        {
            Execute_DownloadDatasourcesList(serverLogin);
        }

        //===================================================================================
        //Datasources download...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadDatasources))
        {
            Execute_DownloadDatasources(
                serverLogin
                , exportToPath
                , projectNameIdMapping
                , exportSingleProject
                , taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ExportOnlyTaggedWith)
                , taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_RemoveTagFromExportedContent)
                );
        }


        //===================================================================================
        //Workbooks download...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadWorkbooks))
        {
            Execute_DownloadWorkbooks(
                serverLogin
                , exportToPath
                , projectNameIdMapping
                , exportSingleProject
                , taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ExportOnlyTaggedWith)
                , taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_RemoveTagFromExportedContent)
                );
        }

        //===================================================================================
        //List of workbooks? (does not download actual workbooks, just the list)
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetWorkbooksList))
        {
            Execute_DownloadWorkbooksList(serverLogin);

            //Do we want to download the connection information for each workbook?
            if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetWorkbooksConnections))
            {
                Execute_DownloadWorkbooksConnections(
                    serverLogin
                    , this.WorkbooksList);
            }
        }

        //===================================================================================
        //Are there database credentials we need to associate with content being uploaded...
        //===================================================================================
        var pathDBCredentials = taskOptions.GetOptionValue(TaskMasterOptions.Option_DBCredentialsPath);
        CredentialManager uploadCredentialManager = null;

        if (!string.IsNullOrWhiteSpace(pathDBCredentials))
        {
            uploadCredentialManager = Execute_LoadDBCredentialsFile(pathDBCredentials);
        }

        //===================================================================================
        //Datasources upload...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadDatasources))
        {
            Execute_UploadDatasources(
                serverLogin,
                taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_PathUploadFrom),
                uploadCredentialManager);
        }

        //===================================================================================
        //Workbooks upload...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadWorkbooks))
        {
            Execute_UploadWorkbooks(
                serverLogin,
                taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_PathUploadFrom),
                taskOptions.IsOptionSet(TaskMasterOptions.Option_RemapWorkbookReferencesOnUpload),
                uploadCredentialManager);
        }

        //===================================================================================
        //Save the site inventory file
        //===================================================================================
        var inventoryFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveInventoryFile);

        if (!string.IsNullOrWhiteSpace(inventoryFile))
        {
            Execute_GenerateSiteInventoryFile(inventoryFile);

            //Do we want to generate a TWB file that uses the inventory file
            if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GenerateInventoryTwb))
            {
                Execute_GenerateSiteInventoryFile_Twb(inventoryFile);
            }
        }

        //===================================================================================
        //Save the manual steps file
        //===================================================================================
        var manualStepsFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveManualSteps);

        if (!string.IsNullOrWhiteSpace(manualStepsFile))
        {
            Execute_GenerateManualStepsFile(manualStepsFile);
        }

        //===================================================================================
        //Save the logs file
        //===================================================================================
        var logFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveLogFile);

        if (!string.IsNullOrWhiteSpace(logFile))
        {
            Execute_SaveLogFile(logFile);
        }

        //===================================================================================
        //Save the errors file
        //===================================================================================
        var errorsFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveErrorsFile);

        if (!string.IsNullOrWhiteSpace(errorsFile))
        {
            Execute_SaveErrorsFile(errorsFile);
        }
    }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadSubscriptionsList(TableauServerUrls onlineUrls, TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = onlineUrls;
 }
Exemplo n.º 23
0
    /// <summary>
    /// Download the workbooks
    /// </summary>
    /// <param name="onlineLogin">logged in session</param>
    /// <param name="exportToPath">local path to export to</param>
    /// <param name="projectsList">project id/name mapping</param>
    /// <param name="singleProjectIdFilter">if specified, export only from a single project</param>
    /// <param name="exportOnlyWithThisTag">if specified, export only content with this tag</param>
    /// <param name="deleteTagAfterExport">TRUE: Remove the server-side tag from exported content (only valid if we have an export tag)</param>
    private void Execute_DownloadWorkbooks(
        TableauServerSignIn onlineLogin,
        string exportToPath,
        IProjectsList projectsList,
        SiteProject singleProjectIdFilter = null,
        string exportOnlyWithThisTag      = null,
        bool deleteTagAfterExport         = false)
    {
        var onlineUrls = _onlineUrls;

        _statusLog.AddStatusHeader("Download workbooks");

        //Get the UserID we need to use for the workbooks query.
        var explicitUserId = onlineLogin.UserId; //See if we have a default user id

        //===================================================================================
        //Workbooks...
        //===================================================================================
        ICollection <SiteWorkbook> workbooksList = null;

        try
        {
            var workbooks = new DownloadWorkbooksList(onlineUrls, onlineLogin, explicitUserId);
            //Query for the list of workbook
            workbooks.ExecuteRequest();
            workbooksList = workbooks.Workbooks;
        }
        catch (Exception exWorkbooksList)
        {
            _statusLog.AddError("Error querying for list of workbooks, " + exWorkbooksList.Message.ToString());
            return;
        }

        //No list of workbooks?  Exit.
        if (workbooksList == null)
        {
            _statusLog.AddStatus("Aborting workbooks download");
            return;
        }

        //====================================================================================================
        //Apply filters to the list of content to see if we need to reduce the set of content to be downloaded
        //====================================================================================================
        var filteredList = workbooksList;

        _statusLog.AddStatus("Download workbooks count before filters: " + filteredList.Count.ToString());

        //See if we have a PROJECTS filter to apply to the set of content to be downloaded
        filteredList = FilterProjectMembership <SiteWorkbook> .KeepOnlyProjectMembers(
            filteredList,
            singleProjectIdFilter,
            true);

        _statusLog.AddStatus("Download workbooks count after projects filter: " + filteredList.Count.ToString());

        //See if we have a TAGS filter to apply to the set of content to be downloaded
        filteredList = FilterTagSet <SiteWorkbook> .KeepOnlyTagged(
            filteredList,
            exportOnlyWithThisTag,
            true);

        _statusLog.AddStatus("Download workbooks count after tags filter: " + filteredList.Count.ToString());

        //-----------------------------------------------------------
        //Download the workbooks
        //-----------------------------------------------------------
        var workbookPath = Path.Combine(exportToPath, "workbooks");
        ICollection <SiteWorkbook> successfullExportSet = null;

        FileIOHelper.CreatePathIfNeeded(workbookPath);
        try
        {
            var workbookDownloads = new DownloadWorkbooks(onlineUrls, onlineLogin, filteredList, workbookPath, projectsList);
            successfullExportSet = workbookDownloads.ExecuteRequest();
        }
        catch (Exception exWorkbooksDownload)
        {
            _statusLog.AddError("Error during workbooks download, " + exWorkbooksDownload.ToString());
        }

        //--------------------------------------------------------------------------------
        //Do we want to remove tags from successfully downloaded content?
        //--------------------------------------------------------------------------------
        if ((successfullExportSet != null) && (deleteTagAfterExport) && (!string.IsNullOrWhiteSpace(exportOnlyWithThisTag)))
        {
            Execute_DeleteTagFromWorkbooks(onlineLogin, successfullExportSet, exportOnlyWithThisTag);
        }
    }
Exemplo n.º 24
0
    /// <summary>
    /// Download the data sources
    /// </summary>
    /// <param name="onlineLogin"></param>
    private void Execute_DownloadDatasources(
        TableauServerSignIn onlineLogin,
        string exportToPath,
        IProjectsList projectsList,
        SiteProject singleProjectIdFilter = null,
        string exportOnlyWithThisTag      = null,
        bool deleteTagAfterExport         = false)
    {
        _statusLog.AddStatusHeader("Download datasources");
        ICollection <SiteDatasource> datasourcesList = null;

        try
        {
            //Get the list of datasources
            var datasourcesManager = new DownloadDatasourcesList(_onlineUrls, onlineLogin);
            datasourcesManager.ExecuteRequest();
            datasourcesList = datasourcesManager.Datasources;
        }
        catch (Exception exGetContentList)
        {
            _statusLog.AddError("Error querying for list of datasources, " + exGetContentList.Message.ToString());
        }

        if (datasourcesList == null)
        {
            _statusLog.AddError("Aborting datasources download");
            return;
        }

        //====================================================================================================
        //Apply filters to the list of content to see if we need to reduce the set of content to be downloaded
        //====================================================================================================
        var filteredList = datasourcesList;

        _statusLog.AddStatus("Download datasources count before filters: " + filteredList.Count.ToString());

        //See if we have a PROJECTS filter to apply to the set of content to download
        filteredList = FilterProjectMembership <SiteDatasource> .KeepOnlyProjectMembers(
            filteredList,
            singleProjectIdFilter,
            true);

        _statusLog.AddStatus("Download datasources count after projects filter: " + filteredList.Count.ToString());

        //See if we have a TAGS filter to apply to the set of content to be downloaded
        filteredList = FilterTagSet <SiteDatasource> .KeepOnlyTagged(
            filteredList,
            exportOnlyWithThisTag,
            true);

        _statusLog.AddStatus("Download datasources count after tags filter: " + filteredList.Count.ToString());

        ICollection <SiteDatasource> successfullExportSet = null;
        var datasourcePath = Path.Combine(exportToPath, "datasources");

        FileIOHelper.CreatePathIfNeeded(datasourcePath);

        //-----------------------------------------------------------
        //Download the data sources
        //-----------------------------------------------------------
        try
        {
            var datasourceDownloads = new DownloadDatasources(
                _onlineUrls,
                onlineLogin,
                filteredList,
                datasourcePath,
                projectsList);
            successfullExportSet = datasourceDownloads.ExecuteRequest();
        }
        catch (Exception exDatasourceDownload)
        {
            _statusLog.AddError("Error during datasource download, " + exDatasourceDownload.ToString());
        }

        //--------------------------------------------------------------------------------
        //Do we want to remove tags from successfully downloaded content?
        //--------------------------------------------------------------------------------
        if ((successfullExportSet != null) && (deleteTagAfterExport) && (!string.IsNullOrWhiteSpace(exportOnlyWithThisTag)))
        {
            Execute_DeleteTagFromDatasources(onlineLogin, successfullExportSet, exportOnlyWithThisTag);
        }
    }
 /// <summary>
 /// Constructor: Call when we want to query the datasource on behalf of the currently logged in user
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadDatasourceConnections(TableauServerUrls onlineUrls, TableauServerSignIn login, string datasourceId)
     : base(login)
 {
     _datasourceId = datasourceId;
     _onlineUrls   = onlineUrls;
 }
Exemplo n.º 26
0
    /// <summary>
    /// Perform the work
    /// </summary>
    private void ExecuteTask_InternalAllTasks()
    {
        string exportToPath = _exportToLocalPath;
        var onlineUrls = _onlineUrls;
        var taskOptions = _taskOptions;

        //========================================================================================
        //Log into Tableau Online
        //========================================================================================
        var serverLogin = new TableauServerSignIn(onlineUrls, _userName, _password, _statusLog);
        try
        {
            serverLogin.ExecuteRequest();
        }
        catch(Exception exLogin)
        {
            _statusLog.AddError("Failed loging, " + exLogin.ToString());

            _isDone = true;
            return;
        }

        //========================================================================================
        //If we need periodic background requests, set them going on a background thread
        //========================================================================================
        if(taskOptions.IsOptionSet(TaskMasterOptions.Option_BackgroundKeepAlive))
        {
            _statusLog.AddStatusHeader("Setting up async background keep-alive requests");
            _asyncKeepAliveBackgroundTasks = new KeepAliveBackgroundWebRequest(onlineUrls, serverLogin);
            _asyncKeepAliveBackgroundTasks.Execute();
        }

        //========================================================================================
        //If there is a custom command we want to execute, do it
        //========================================================================================
        var customCommand1 = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ArbitraryCommand1);
        if (!string.IsNullOrWhiteSpace(customCommand1))
        {
            AttemptExecutionOfCustomHttpGet(serverLogin, customCommand1);
        }
        var customCommand2 = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ArbitraryCommand2);
        if (!string.IsNullOrWhiteSpace(customCommand2))
        {
            AttemptExecutionOfCustomHttpGet(serverLogin, customCommand2);
        }

        //========================================================================================
        //If there is a project we want to create, then do it
        //========================================================================================
        var createProjectName = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_CreateProjectWithName);
        if(!string.IsNullOrWhiteSpace(createProjectName))
        {
            Execute_CreateProjectWithName(serverLogin, createProjectName);
        }

        //========================================================================================
        //Attempt to get the list of users
        //========================================================================================
        if ((taskOptions.IsOptionSet(TaskMasterOptions.Option_GetSiteUsers))
            || (taskOptions.IsOptionSet(TaskMasterOptions.Option_AssignContentOwnershipAfterPublish))) //If we do content remapping, we need the users list
        {
            _downloadedList_Users = Execute_DownloadSiteUsers(serverLogin);
        }

        //========================================================================================
        //Attempt to get the site information
        //========================================================================================
        SiteinfoSite site = null;
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetSiteInfo))
        {
            site = Execute_DownloadSiteInfo(serverLogin);
        }

        //If this gets set then we will pass the information for project/name mapping to the workbook and datasource downloaders
        IProjectsList projectNameIdMapping = null;
        SiteProject exportSingleProject = null;  //If non NULL, then look up the project

        //===================================================================================
        //Projects List
        //===================================================================================
        if ((taskOptions.IsOptionSet(TaskMasterOptions.Option_GetProjectsList)) ||
            (taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadIntoProjects)) ||
            (taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_ExportSingleProject))
            )
        {
            var projectsList = Execute_DownloadProjectsList(serverLogin);

            if(taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadIntoProjects))
            {
                projectNameIdMapping = projectsList;
            }

            //Determine if the there is a project filter
            exportSingleProject = helper_DetermineIfSingleProjectFilter(projectsList);
        }

        //===================================================================================
        //List of groups?
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetGroupsList))
        {
            Execute_DownloadGroupsList(serverLogin);
        }

        //===================================================================================
        //List of datasources? (does not download actual data sources, just the list)
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetDatasourcesList))
        {
            Execute_DownloadDatasourcesList(serverLogin);
        }

        //===================================================================================
        //Datasources download...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadDatasources))
        {
            Execute_DownloadDatasources(
                serverLogin
                ,exportToPath
                ,projectNameIdMapping
                ,exportSingleProject
                ,taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ExportOnlyTaggedWith)
                ,taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_RemoveTagFromExportedContent)
                ,taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_GenerateInfoFilesForDownloadedContent)
                ,_downloadedList_Users
                );
        }

        //===================================================================================
        //Workbooks download...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_DownloadWorkbooks))
        {
            Execute_DownloadWorkbooks(
                 serverLogin
                ,exportToPath
                ,projectNameIdMapping
                ,exportSingleProject
                ,taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_ExportOnlyTaggedWith)
                ,taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_RemoveTagFromExportedContent)
                ,taskOptions.IsOptionSet(TaskMasterOptions.OptionParameter_GenerateInfoFilesForDownloadedContent)
                ,_downloadedList_Users
                );
        }

        //===================================================================================
        //List of workbooks? (does not download actual workbooks, just the list)
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_GetWorkbooksList))
        {
            Execute_DownloadWorkbooksList(serverLogin);

            //Do we want to download the connection information for each workbook?
            if(taskOptions.IsOptionSet(TaskMasterOptions.Option_GetWorkbooksConnections))
            {
                Execute_DownloadWorkbooksConnections(
                    serverLogin
                    , this.WorkbooksList);
            }

        }

        //===================================================================================
        //Are there database credentials we need to associate with content being uploaded...
        //===================================================================================
        var pathDBCredentials = taskOptions.GetOptionValue(TaskMasterOptions.Option_DBCredentialsPath);
        CredentialManager uploadCredentialManager = null;
        if (!string.IsNullOrWhiteSpace(pathDBCredentials))
        {
            uploadCredentialManager = Execute_LoadDBCredentialsFile(pathDBCredentials);
        }

        //===================================================================================
        //Datasources upload...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadDatasources))
        {
            Execute_UploadDatasources(
                serverLogin,
                taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_PathUploadFrom),
                uploadCredentialManager,
                taskOptions.IsOptionSet(TaskMasterOptions.Option_AssignContentOwnershipAfterPublish),
                _downloadedList_Users);
        }

        //===================================================================================
        //Workbooks upload...
        //===================================================================================
        if (taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadWorkbooks))
        {
            Execute_UploadWorkbooks(
                serverLogin,
                taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_PathUploadFrom),
                taskOptions.IsOptionSet(TaskMasterOptions.Option_RemapWorkbookReferencesOnUpload),
                uploadCredentialManager,
                taskOptions.IsOptionSet(TaskMasterOptions.Option_AssignContentOwnershipAfterPublish),
                _downloadedList_Users);
        }

        //===================================================================================
        //Save the site inventory file
        //===================================================================================
        var inventoryFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveInventoryFile);
        if(!string.IsNullOrWhiteSpace(inventoryFile))
        {
            Execute_GenerateSiteInventoryFile(inventoryFile);

            //Do we want to generate a TWB file that uses the inventory file
            if(taskOptions.IsOptionSet(TaskMasterOptions.Option_GenerateInventoryTwb))
            {
                Execute_GenerateSiteInventoryFile_Twb(inventoryFile);
            }
        }

        //===================================================================================
        //Save the manual steps file
        //===================================================================================
        var manualStepsFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveManualSteps);
        if (!string.IsNullOrWhiteSpace(manualStepsFile))
        {
            Execute_GenerateManualStepsFile(manualStepsFile);
        }

        //===================================================================================
        //Save the logs file
        //===================================================================================
        var logFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveLogFile);
        if(!string.IsNullOrWhiteSpace(logFile))
        {
            Execute_SaveLogFile(logFile);
        }

        //===================================================================================
        //Save the errors file
        //===================================================================================
        var errorsFile = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_SaveErrorsFile);
        if (!string.IsNullOrWhiteSpace(errorsFile))
        {
            Execute_SaveErrorsFile(errorsFile);
        }

        //===================================================================================
        //Sign out and clean up
        //===================================================================================
        if(_asyncKeepAliveBackgroundTasks != null) //If we had background async keep alive tasks, tell them to stop
        {
            _asyncKeepAliveBackgroundTasks.ExitAsync();
            _asyncKeepAliveBackgroundTasks = null;
        }
        //Sign out of Tableau Server
        _statusLog.AddStatusHeader("Sign out");
        serverLogin.SignOut(onlineUrls);
    }
Exemplo n.º 27
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
//    public DownloadUsersList(TableauServerUrls onlineUrls, TableauServerSignIn login)
    public DownloadUsersList(TableauServerSignIn login)
        : base(login)
    {
    }
Exemplo n.º 28
0
    /// <summary>
    /// Attempt to remove a tag from a set of workbooks
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="contentSet"></param>
    /// <param name="removeTag"></param>
    private void Execute_DeleteTagFromWorkbooks(
        TableauServerSignIn onlineLogin, 
        ICollection<SiteWorkbook> contentSet, 
        string removeTag)
    {
        if(string.IsNullOrWhiteSpace(removeTag))
        {
            throw new ArgumentException("Tag to remove is blank");
        }

        //Nothing to do?
        if(contentSet == null)
        {
            return;
        }

        var onlineUrls = _onlineUrls;
        _statusLog.AddStatusHeader("Deleting tag '" + removeTag +  "' from " + contentSet.Count.ToString() + " workbooks");
        //Make the delete tag request for each workbook
        foreach(var contentItem in contentSet)
        {
            try
                {
                    var tagDelete = new SendDeleteWorkbookTag(onlineUrls, onlineLogin, contentItem.Id, removeTag);
                    tagDelete.ExecuteRequest();
                }
            catch(Exception exDeleteTag)
                {
                    _statusLog.AddError(
                        "Error attempting to delete tag from workbook " +
                        contentItem.Id + "/" + removeTag
                        + ", " + exDeleteTag.Message);
                }
        }//end: foreach
    }
Exemplo n.º 29
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="login"></param>
 public TableauServerSignedInRequestBase(TableauServerSignIn login)
 {
     _onlineSession = login;
 }
Exemplo n.º 30
0
    /// <summary>
    /// Update the unexpected user based on the specified behavior
    /// </summary>
    /// <param name="unexpectedUser"></param>
    /// <param name="siteSignIn"></param>
    /// <param name="behavior"></param>
    private void Execute_UpdateUnexpectedUsersProvisioning_SingleUser_WithBehavior(SiteUser unexpectedUser, TableauServerSignIn siteSignIn, ProvisionUserInstructions.UnexpectedUserAction behavior)
    {
        switch (behavior)
        {
        case ProvisionUserInstructions.UnexpectedUserAction.Report:
            _statusLogs.AddStatus("No action: Keep unexpected user unaltered. User: "******"Per provisioning instructions, unknown existing user left unaltered");
                 */
                CSVRecord_UserModified(
                    unexpectedUser.Name,
                    unexpectedUser.SiteRole,
                    unexpectedUser.SiteAuthentication,
                    "SIMULATED existing/removed",
                    unexpectedUser.SiteRole + "->" + "Unlicensed");
                return;
            }

            return;

        case ProvisionUserInstructions.UnexpectedUserAction.Unlicense:
            //If the user is already unlicensed, then there is nothing that needs to be done
            if (unexpectedUser.SiteRoleParsed == SiteUserRole.Unlicensed)
            {
                return;
            }

            _statusLogs.AddStatus("Unlicense unexpected user: "******"existing/removed",
                unexpectedUser.SiteRole + "->" + userUpdated.SiteRole);
            return;

        default:
            IwsDiagnostics.Assert(false, "811-1130: Internal error. Unknown provisioning behavior for user " + unexpectedUser.ToString());
            _statusLogs.AddError("811-1130: Internal error. Unknown provisioning behavior for user " + unexpectedUser.ToString());
            return;
        }
    }
Exemplo n.º 31
0
 /// <summary>
 /// Constructor: Call when we want to query the Workbooks on behalf of an explicitly specified user
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="user"></param>
 public DownloadWorkbooksList(TableauServerUrls onlineUrls, TableauServerSignIn login, string userId) : base(login)
 {
     _onlineUrls = onlineUrls;
     _userId     = userId;
 }
Exemplo n.º 32
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadGroupsList(TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = login.ServerUrls;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="login"></param>
 protected TableauServerSignedInRequestBase(TableauServerSignIn login)
 {
     OnlineSession = login;
 }
Exemplo n.º 34
0
 /// <summary>
 /// Constructor: Call when we want to query the workbooks on behalf of the currently logged in user
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadWorkbookConnections(TableauServerUrls onlineUrls, TableauServerSignIn login, string workbookId)
     : base(login)
 {
     _workbookId = workbookId;
     _onlineUrls = onlineUrls;
 }
Exemplo n.º 35
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadProjectsList(TableauServerUrls onlineUrls, TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = onlineUrls;
 }
Exemplo n.º 36
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="onlineUrls"></param>
    /// <param name="login"></param>
    /// <param name="user"></param>
    public DownloadSiteInfo(TableauServerUrls onlineUrls, TableauServerSignIn login)
        : base(login)
    {
        _onlineUrls = onlineUrls;
//        _user = user;
    }
Exemplo n.º 37
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="exportToPath"></param>
    /// <param name="projectsList"></param>
    /// <param name="singleProjectIdFilter"></param>
    /// <param name="exportOnlyWithThisTag"></param>
    /// <param name="deleteTagAfterExport"></param>
    /// <param name="generateInfoFile">TRUE: Each downloaded workbook will get an information file generated that has additional metadata about it</param>
    /// <param name="siteUsers"> If not NULL, then this will get used to look the user name for each downloaded workbook, and safe it into the info file</param>
    private void Execute_DownloadDatasources(
        TableauServerSignIn onlineLogin, 
        string exportToPath, 
        IProjectsList projectsList,
        SiteProject singleProjectIdFilter = null,
        string exportOnlyWithThisTag      = null,
        bool deleteTagAfterExport         = false,
        bool generateInfoFile             = false,
        IEnumerable<SiteUser>   siteUsers = null
        )
    {
        _statusLog.AddStatusHeader("Download datasources");
        ICollection<SiteDatasource> datasourcesList = null;
        try
        {
            //Get the list of datasources
            var datasourcesManager = new DownloadDatasourcesList(_onlineUrls, onlineLogin);
            datasourcesManager.ExecuteRequest();
            datasourcesList = datasourcesManager.Datasources;
        }
        catch(Exception exGetContentList)
        {
            _statusLog.AddError("Error querying for list of datasources, " + exGetContentList.Message.ToString());
        }

        if(datasourcesList == null)
        {
            _statusLog.AddError("Aborting datasources download");
            return;
        }

        //====================================================================================================
        //Apply filters to the list of content to see if we need to reduce the set of content to be downloaded
        //====================================================================================================
        var filteredList = datasourcesList;
        _statusLog.AddStatus("Download datasources count before filters: " + filteredList.Count.ToString());

        //See if we have a PROJECTS filter to apply to the set of content to download
        filteredList = FilterProjectMembership<SiteDatasource>.KeepOnlyProjectMembers(
            filteredList,
            singleProjectIdFilter,
            true);
        _statusLog.AddStatus("Download datasources count after projects filter: " + filteredList.Count.ToString());

        //See if we have a TAGS filter to apply to the set of content to be downloaded
        filteredList = FilterTagSet<SiteDatasource>.KeepOnlyTagged(
            filteredList,
            exportOnlyWithThisTag,
            true);
        _statusLog.AddStatus("Download datasources count after tags filter: " + filteredList.Count.ToString());

        ICollection<SiteDatasource> successfullExportSet = null;
        var datasourcePath = Path.Combine(exportToPath, "datasources");
        FileIOHelper.CreatePathIfNeeded(datasourcePath);

        //-----------------------------------------------------------
        //Download the data sources
        //-----------------------------------------------------------
        //If we are going to write out metadata for each download, then create the object that lets us look up the owner of each workbook
        KeyedLookup<SiteUser> contentOwnerLookup = null;
        if ((generateInfoFile) && (siteUsers != null))
        {
            contentOwnerLookup = new KeyedLookup<SiteUser>(siteUsers);
        }
        try
        {
            var datasourceDownloads = new DownloadDatasources(
                _onlineUrls,
                onlineLogin,
                filteredList,
                datasourcePath,
                projectsList,
                generateInfoFile,
                contentOwnerLookup);
            successfullExportSet = datasourceDownloads.ExecuteRequest();
        }
        catch (Exception exDatasourceDownload)
        {
            _statusLog.AddError("Error during datasource download, " + exDatasourceDownload.ToString());
        }

        //--------------------------------------------------------------------------------
        //Do we want to remove tags from successfully downloaded content?
        //--------------------------------------------------------------------------------
        if ((successfullExportSet != null) && (deleteTagAfterExport) && (!string.IsNullOrWhiteSpace(exportOnlyWithThisTag)))
        {
            Execute_DeleteTagFromDatasources(onlineLogin, successfullExportSet, exportOnlyWithThisTag);
        }
    }
Exemplo n.º 38
0
 /// <summary>
 /// Constructor: Call when we want to query the workbooks on behalf of the currently logged in user
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadWorkbooksList(TableauServerSignIn login, int maxNumberItems = int.MaxValue)
     : this(login, login.UserId, false, maxNumberItems)
 {
 }
Exemplo n.º 39
0
    /// <summary>
    /// Downloads the set of groups in the site
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <returns></returns>
    private DownloadGroupsList Execute_DownloadGroupsList(TableauServerSignIn onlineLogin)
    {
        var onlineUrls = _onlineUrls;
        _statusLog.AddStatusHeader("Request site groups");
        DownloadGroupsList groups = null;
        //===================================================================================
        //Projects...
        //===================================================================================
        try
        {
            groups = new DownloadGroupsList(onlineUrls, onlineLogin);
            groups.ExecuteRequest();

            //List all the groups
            foreach (var thisGroup in groups.Groups)
            {
                _statusLog.AddStatus(thisGroup.ToString());
            }
        }
        catch (Exception ex)
        {
            _statusLog.AddError("Error during groups query, " + ex.ToString());
        }

        //Store it
        _downloadedList_Groups = groups.Groups;
        return groups;
    }
Exemplo n.º 40
0
    /// <summary>
    /// URL to get the list of Users in a Group
    /// </summary>
    /// <param name="logInInfo"></param>
    /// <param name="groupId"></param>
    /// <param name="pageSize"></param>
    /// <param name="pageNumber"></param>
    /// <returns></returns>
    public string Url_UsersListInGroup(TableauServerSignIn logInInfo, string groupId, int pageSize, int pageNumber = 1)
    {
        string workingText = _urlListUsersInGroupTemplate.Replace("{{iwsSiteId}}", logInInfo.SiteId);
        workingText = workingText.Replace("{{iwsGroupId}}", groupId);
        workingText = workingText.Replace("{{iwsPageSize}}", pageSize.ToString());
        workingText = workingText.Replace("{{iwsPageNumber}}", pageNumber.ToString());
        ValidateTemplateReplaceComplete(workingText);

        return workingText;
    }
Exemplo n.º 41
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="onlineLogin"></param>
    private SiteinfoSite Execute_DownloadSiteInfo(TableauServerSignIn onlineLogin)
    {
        SiteinfoSite site = null;

        _statusLog.AddStatusHeader("Request site info");
        try
        {
            var getSiteInfo = new DownloadSiteInfo(_onlineUrls, onlineLogin);
            getSiteInfo.ExecuteRequest();
            site = getSiteInfo.Site;
        }
        catch (Exception exSite)
        {
            _statusLog.AddError("Error getting site info, " + exSite.ToString());
        }

        return site;
    }
Exemplo n.º 42
0
 /// <summary>
 /// Constructor: Call when we want to query the Workbooks on behalf of an explicitly specified user
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="user"></param>
 public DownloadWorkbooksList(TableauServerUrls onlineUrls, TableauServerSignIn login, string userId) : base(login)
 {
     _onlineUrls = onlineUrls;
     _userId = userId;
 }
Exemplo n.º 43
0
    /// <summary>
    /// Download the workbooks
    /// </summary>
    /// <param name="onlineLogin">logged in session</param>
    /// <param name="exportToPath">local path to export to</param>
    /// <param name="projectsList">project id/name mapping</param>
    /// <param name="singleProjectIdFilter">if specified, export only from a single project</param>
    /// <param name="exportOnlyWithThisTag">if specified, export only content with this tag</param>
    /// <param name="deleteTagAfterExport">TRUE: Remove the server-side tag from exported content (only valid if we have an export tag)</param>
    /// <param name="generateInfoFile">TRUE: Each downloaded workbook will get an information file generated that has additional metadata about it</param>
    /// <param name="siteUsers"> If not NULL, then this will get used to look the user name for each downloaded workbook, and safe it into the info file</param>
    private void Execute_DownloadWorkbooks(
        TableauServerSignIn onlineLogin, 
        string exportToPath, 
        IProjectsList projectsList,
        SiteProject singleProjectIdFilter = null,
        string exportOnlyWithThisTag      = null,
        bool deleteTagAfterExport         = false,
        bool generateInfoFile             = false,
        IEnumerable<SiteUser> siteUsers   = null
        )
    {
        var onlineUrls = _onlineUrls;
        _statusLog.AddStatusHeader("Download workbooks");

        //Get the UserID we need to use for the workbooks query.
        var explicitUserId = onlineLogin.UserId; //See if we have a default user id

        //===================================================================================
        //Workbooks...
        //===================================================================================
        ICollection<SiteWorkbook> workbooksList = null;
        try
        {
            var workbooks = new DownloadWorkbooksList(onlineUrls, onlineLogin, explicitUserId);
            //Query for the list of workbook
            workbooks.ExecuteRequest();
            workbooksList = workbooks.Workbooks;

        }
        catch (Exception exWorkbooksList)
        {
            _statusLog.AddError("Error querying for list of workbooks, " + exWorkbooksList.Message.ToString());
            return;
        }

        //No list of workbooks?  Exit.
        if(workbooksList == null)
        {
            _statusLog.AddStatus("Aborting workbooks download");
            return;
        }

        //====================================================================================================
        //Apply filters to the list of content to see if we need to reduce the set of content to be downloaded
        //====================================================================================================
        var filteredList = workbooksList;
        _statusLog.AddStatus("Download workbooks count before filters: " + filteredList.Count.ToString());

        //See if we have a PROJECTS filter to apply to the set of content to be downloaded
        filteredList = FilterProjectMembership<SiteWorkbook>.KeepOnlyProjectMembers(
                            filteredList,
                            singleProjectIdFilter,
                            true);
        _statusLog.AddStatus("Download workbooks count after projects filter: " + filteredList.Count.ToString());

        //See if we have a TAGS filter to apply to the set of content to be downloaded
        filteredList = FilterTagSet<SiteWorkbook>.KeepOnlyTagged(
            filteredList,
            exportOnlyWithThisTag,
            true);
        _statusLog.AddStatus("Download workbooks count after tags filter: " + filteredList.Count.ToString());

        //-----------------------------------------------------------
        //Download the workbooks
        //-----------------------------------------------------------
        var workbookPath = Path.Combine(exportToPath, "workbooks");
        ICollection<SiteWorkbook> successfullExportSet = null;
        FileIOHelper.CreatePathIfNeeded(workbookPath);

        //If we are going to write out metadata for each download, then create the object that lets us look up the owner of each workbook
        KeyedLookup<SiteUser> workbookOwnerLookup = null;
        if ((generateInfoFile) && (siteUsers != null))
        {
            workbookOwnerLookup = new KeyedLookup<SiteUser>(siteUsers);
        }
        //Do the downloads......
        try
        {
            //Create the workbooks downloader
            var workbookDownloads = new DownloadWorkbooks(
                onlineUrls,
                onlineLogin,
                filteredList,
                workbookPath,
                projectsList,
                generateInfoFile,
                workbookOwnerLookup);
            successfullExportSet = workbookDownloads.ExecuteRequest();
        }
        catch (Exception exWorkbooksDownload)
        {
            _statusLog.AddError("Error during workbooks download, " + exWorkbooksDownload.ToString());
        }

        //--------------------------------------------------------------------------------
        //Do we want to remove tags from successfully downloaded content?
        //--------------------------------------------------------------------------------
        if ((successfullExportSet != null) && (deleteTagAfterExport) && (!string.IsNullOrWhiteSpace(exportOnlyWithThisTag)))
        {
            Execute_DeleteTagFromWorkbooks(onlineLogin, successfullExportSet, exportOnlyWithThisTag);
        }
    }
Exemplo n.º 44
0
    /// <summary>
    /// Called to attempt to execute a custom command (to be run after the user logs in)
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="customCommand"></param>
    private void AttemptExecutionOfCustomHttpGet(TableauServerSignIn onlineLogin, string customCommand)
    {
        _statusLog.AddStatusHeader("GET request: " + customCommand);
        var customGetRequest = new SendPostLogInCommand(_onlineUrls, onlineLogin, customCommand);
        try
        {
            var customResult = customGetRequest.ExecuteRequest();
            _statusLog.AddStatus("GET result: " + customResult);
        }
        catch (Exception exCustomCommand)
        {
            _statusLog.AddError("Error during custom GET, " + exCustomCommand.ToString());

        }
    }
Exemplo n.º 45
0
        public void ViewPdfLinkTest()
        {
            var url = new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9);

            var signIn = new TableauServerSignIn(
                url,
                "tableauAdmin",
                "ta1user%", new TaskStatusLogs());

            signIn.ExecuteRequest();
            var workbooks =
                new DownloadWorkbooksList(
                    new TableauServerUrls(ServerProtocol.Http, "10.107.0.240:8000", "ITCostSurvey", 10, ServerVersion.Server9),
                    signIn);

            workbooks.ExecuteRequest();
            var workbook  = workbooks.Workbooks.First();
            var viewQuery = new DownloadViewsForWorkbookList(workbook.Id, url, signIn);

            viewQuery.ExecuteRequest();
            var view         = viewQuery.Views.First();
            var a            = new TrustedUrls(workbook.Name.Replace(" ", ""), view.Name.Replace(" ", ""), url, signIn);
            var exportPdfUrl = a.GetExportPdfUrl();

            Assert.IsFalse(string.IsNullOrEmpty(exportPdfUrl));
            var thumbnailUrl = a.GetPreviewImageUrl();

            Assert.IsFalse(string.IsNullOrEmpty(thumbnailUrl));
            var viewUrl = a.GetTrustedViewUrl();

            Assert.IsFalse(string.IsNullOrEmpty(viewUrl));

            var client = new WebClient();

            var data = client.DownloadData(exportPdfUrl);

            Assert.IsNotNull(data);
            Assert.IsTrue(data.Any());

            data = null;

            var downloadView = new DownloadView(url, signIn);

            data = downloadView.GetPreviewImage(workbook.Id, view.Id);
            Assert.IsNotNull(data);
            Assert.IsTrue(data.Any());

            a.AddViewParameter("Gabba", "1");
            a.AddViewParameter("Hey", "2");

            exportPdfUrl = a.GetExportPdfUrl();
            Assert.IsTrue(exportPdfUrl.Contains("?"));
            Assert.IsTrue(exportPdfUrl.EndsWith("Gabba=1&Hey=2"));

            thumbnailUrl = a.GetPreviewImageUrl();
            Assert.IsTrue(thumbnailUrl.Contains("?"));
            Assert.IsTrue(thumbnailUrl.EndsWith("Gabba=1&Hey=2"));

            a.HideToolbar = true;
            viewUrl       = a.GetTrustedViewUrl();
            Assert.IsTrue(viewUrl.EndsWith("&:toolbar=no"));

            a.HideToolbar = null;
            viewUrl       = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("&:toolbar=no"));

            a.HideToolbar = false;
            viewUrl       = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("&:toolbar=no"));

            a.HideTabs = true;
            viewUrl    = a.GetTrustedViewUrl();
            Assert.IsTrue(viewUrl.EndsWith("&:tabs=no"));

            a.HideTabs = null;
            viewUrl    = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("&:tabs=no"));

            a.HideTabs = false;
            viewUrl    = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("&:tabs=no"));

            a             = new TrustedUrls(workbook.Name.Replace(" ", ""), view.Name.Replace(" ", ""), url, signIn);
            a.HideToolbar = true;
            viewUrl       = a.GetTrustedViewUrl();
            Assert.IsTrue(viewUrl.EndsWith("?:toolbar=no"));

            a.HideToolbar = null;
            viewUrl       = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("?:toolbar=no"));

            a.HideToolbar = false;
            viewUrl       = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("?:toolbar=no"));

            a.HideTabs = true;
            viewUrl    = a.GetTrustedViewUrl();
            Assert.IsTrue(viewUrl.EndsWith("?:tabs=no"));

            a.HideTabs = null;
            viewUrl    = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("?:tabs=no"));

            a.HideTabs = false;
            viewUrl    = a.GetTrustedViewUrl();
            Assert.IsFalse(viewUrl.EndsWith("?:tabs=no"));

            a.HideToolbar = true;
            a.HideTabs    = true;
            viewUrl       = a.GetTrustedViewUrl();
            Assert.IsTrue(viewUrl.EndsWith("?:tabs=no&:toolbar=no"));
        }
Exemplo n.º 46
0
 /// <summary>
 /// Attempts to create a project
 /// </summary>
 /// <param name="onlineLogin"></param>
 /// <param name="projectName"></param>
 private void Execute_CreateProjectWithName(TableauServerSignIn onlineLogin, string projectName)
 {
     var onlineUrls = _onlineUrls;
     _statusLog.AddStatusHeader("Create project: " + projectName);
     try
     {
         var createProject = new SendCreateProject(onlineUrls, onlineLogin, projectName);
         createProject.ExecuteRequest();
     }
     catch (Exception ex)
     {
         _statusLog.AddError("Error during project create, " + ex.Message);
     }
 }
Exemplo n.º 47
0
    /// <summary>
    /// The MODIDFY-Existing user path for user provisioning
    /// </summary>
    /// <param name="siteSignIn"></param>
    /// <param name="userToProvision"></param>
    /// <param name="missingUserAction"></param>
    private void Execute_ProvisionUsers_SingleUser_ModifyUser(TableauServerSignIn siteSignIn, ProvisioningUser userToProvision, SiteUser existingUser)
    {
        ProvisionUserInstructions.ExistingUserAction existingUserAction;
        switch (existingUser.SiteAuthenticationParsed)
        {
        case SiteUserAuth.Default:
            existingUserAction = _provisionInstructions.ActionForExistingDefaultAuthUsers;
            break;

        case SiteUserAuth.SAML:
            existingUserAction = _provisionInstructions.ActionForExistingSamlUsers;
            break;

        default:
            IwsDiagnostics.Assert(false, "814-1234: Unknown user auth type");
            throw new Exception("814-1234: Unknown user auth type");
        }

        switch (existingUserAction)
        {
        //Modify the existing user
        case ProvisionUserInstructions.ExistingUserAction.Modify:
            _statusLogs.AddStatus("Update user: User exists but role or auth differs. Update: " + userToProvision.UserName);
            var updateUser = new SendUpdateUser(
                siteSignIn.ServerUrls,
                siteSignIn,
                existingUser.Id,
                userToProvision.UserRole,
                userToProvision.UserAuthenticationParsed);

            var userUpdated = updateUser.ExecuteRequest();

            //-------------------------------------------------------------------------------
            //Record the action in an output file
            //-------------------------------------------------------------------------------
            CSVRecord_UserModified(
                userToProvision.UserName,
                userToProvision.UserRole,
                userToProvision.UserAuthentication,
                "existing/modified",
                existingUser.SiteRole + "->" + userUpdated.SiteRole + ", " + existingUser.SiteAuthentication + "->" + userUpdated.SiteAuthentication);
            return;

        //Don't modify, but report
        case ProvisionUserInstructions.ExistingUserAction.Report:
            //-------------------------------------------------------------------------------
            //Record the action in an output file
            //-------------------------------------------------------------------------------

            /*                CSVRecord_Warning(
             *                  userToProvision.UserName,
             *                  userToProvision.UserRole,
             *                  userToProvision.UserAuthentication,
             *                  "Modify user: Per provisioning instructions, existing user left unaltered. " + existingUser.SiteRole + "->" + userToProvision.UserRole + ", " + existingUser.SiteAuthentication + "->" + userToProvision.UserAuthentication);
             */
            CSVRecord_UserModified(
                userToProvision.UserName,
                userToProvision.UserRole,
                userToProvision.UserAuthentication,
                "SIMULATED existing/modified",
                existingUser.SiteRole + "->" + userToProvision.UserRole + ", " + existingUser.SiteAuthentication + "->" + userToProvision.UserAuthentication);
            return;

        default:
            IwsDiagnostics.Assert(false, "814-1237: Internal error. Unknown modify user action");
            throw new Exception("814-1237: Internal error. Unknown modify user action");
        }
    }
Exemplo n.º 48
0
    /// <summary>
    /// Downloads the connections list for each datasource specified
    /// </summary>
    /// <param name="serverLogin"></param>
    /// <param name="serverContent"></param>
    private void Execute_DownloadDatasourceConnections(
        TableauServerSignIn serverLogin,
        IEnumerable<SiteDatasource> serverContent)
    {
        _statusLog.AddStatusHeader("Download each datasource's connections");
        if (serverContent == null)
        {
            _statusLog.AddError("Null datasources list");
            return;
        }

        //For each content item attempt to download it's list of connections
        foreach (var contentItem in serverContent)
        {
            try
            {
                //Request the list of data connections embedded in the content
                var dsDownloadConnections = new DownloadDatasourceConnections(
                    _onlineUrls,
                    serverLogin,
                    contentItem.Id);
                dsDownloadConnections.ExecuteRequest();

                //Put it into the content object
                //Note: We are using a dedicated interface expose the Edit/Set method because most people using the
                //      object only want to read the data
                ((IEditDataConnectionsSet)contentItem).SetDataConnections(dsDownloadConnections.Connections);
            }
            catch (Exception ex)
            {
                _statusLog.AddError("Error attepting to get data connection information for " + contentItem.Id + "/" + contentItem.Name + ", " + ex.Message);
            }
        }//end: foreach
    }
Exemplo n.º 49
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadSchedulesList(TableauServerUrls onlineUrls, TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = onlineUrls;
 }
Exemplo n.º 50
0
    /// <summary>
    /// Download the data sources
    /// </summary>
    /// <param name="onlineLogin"></param>
    private void Execute_DownloadDatasourcesList(TableauServerSignIn onlineLogin)
    {
        _statusLog.AddStatusHeader("Download datasources list");
        try
        {
            //Get the list of workbooks
            var datasources = new DownloadDatasourcesList(_onlineUrls, onlineLogin);
            datasources.ExecuteRequest();

            //Store them in our object
            _downloadedList_Datasources = datasources.Datasources;
        }
        catch (Exception exDatasourceDownload)
        {
            _statusLog.AddError("Error during datasource list download, " + exDatasourceDownload.ToString());
        }
    }
 public SendPostLogInCommand(TableauServerUrls onlineUrls, TableauServerSignIn login, string commandUrl)
     : base(login)
 {
     _onlineUrls          = onlineUrls;
     _postLoginCommandUrl = commandUrl;
 }
Exemplo n.º 52
0
    /// <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;
    }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadRecentAccessedContentList(TableauServerUrls onlineUrls, TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = onlineUrls;
 }
Exemplo n.º 54
0
    /// <summary>
    /// Download the users in the site
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <returns></returns>
    private IEnumerable<SiteUser> Execute_DownloadSiteUsers(TableauServerSignIn onlineLogin)
    {
        var onlineUrls = _onlineUrls;
        _statusLog.AddStatusHeader("Request site users");
        DownloadUsersList users = null;
        //===================================================================================
        //Users...
        //===================================================================================
        try
        {
            users = new DownloadUsersList(onlineUrls, onlineLogin);
            users.ExecuteRequest();

            //List all the users
            foreach(var singleUser in users.Users)
            {
                _statusLog.AddStatus("user: "******"/" + singleUser.SiteRole + "/" + singleUser.Id.ToString());
            }
            return users.Users;
        }
        catch (Exception exUsersQuery)
        {
            _statusLog.AddError("Error during users query, " + exUsersQuery.ToString());
            return null;
        }
    }
Exemplo n.º 55
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadUsersListBase(TableauServerUrls onlineUrls, TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = onlineUrls;
 }
Exemplo n.º 56
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 public DownloadProjectsList(TableauServerUrls onlineUrls, TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = onlineUrls;
 }
Exemplo n.º 57
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onlineUrls"></param>
 /// <param name="login"></param>
 /// <param name="user"></param>
 public TableauServerSignOut(TableauServerUrls onlineUrls, TableauServerSignIn login)
     : base(login)
 {
     _onlineUrls = onlineUrls;
 }