ExecuteRequest() public method

Upload all the datasource files
public ExecuteRequest ( ) : void
return void
Exemplo n.º 1
0
        protected ICollection <SiteDatasource> UploadDatasourceFiles(string projectName, string datasourceUsername, string datasourcePassword, bool isEmbedded, string path)
        {
            var credentialManager = new CredentialManager();

            foreach (var thisFilePath in Directory.GetFiles(path))
            {
                credentialManager.AddDatasourceCredential(Path.GetFileName(thisFilePath), projectName, datasourceUsername, datasourcePassword, isEmbedded);
            }

            var uploadRequest = new UploadDatasources(Urls, Login, credentialManager, path, false, new List <SiteUser>(), HttpClientFactory);

            uploadRequest.ExecuteRequest();
            return(uploadRequest.UploadeDatasources);
        }
Exemplo n.º 2
0
    /// <summary>
    /// Called to perform Uploads of the data sources
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="localBasePath"></param>
    /// <param name="credentialManager">Database credentials that will be associaed with uploaded content</param>
    private void Execute_UploadDatasources(
        TableauServerSignIn onlineLogin,
        string localBasePath,
        CredentialManager credentialManager)
    {
        StatusLog.AddStatusHeader("Upload datasources");

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

        string pathDataSources = Path.Combine(localBasePath, "datasources");

        if (!Directory.Exists(pathDataSources))
        {
            _statusLog.AddStatus("Skipping datasources upload. Local datasources path does not exist: \"" + pathDataSources + "\"");
            return;
        }

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


        var dsUploader = new UploadDatasources(
            _onlineUrls,
            onlineLogin,
            credentialManager,
            pathDataSources,
            uploadProjectBehavior,
            _manualActions,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds);

        try
        {
            dsUploader.ExecuteRequest();
        }
        catch (Exception exUploader)
        {
            StatusLog.AddError("Aborted upload datasources. Unexpected error + " + exUploader.Message);
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Called to perform Uploads of the data sources
    /// </summary>
    /// <param name="onlineLogin"></param>
    /// <param name="localBasePath"></param>
    /// <param name="credentialManager">Database credentials that will be associaed with uploaded content</param>
    private void Execute_UploadDatasources(
        TableauServerSignIn onlineLogin, 
        string localBasePath,
        CredentialManager credentialManager,
        bool attemptContentOwnershipAssignment,
        IEnumerable<SiteUser> siteUsers)
    {
        StatusLog.AddStatusHeader("Upload datasources");

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

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

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

        var dsUploader = new UploadDatasources(
            _onlineUrls,
            onlineLogin,
            credentialManager,
            pathDataSources,
            uploadProjectBehavior,
            _manualActions,
            attemptContentOwnershipAssignment,
            siteUsers,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds);
        try
        {
            dsUploader.ExecuteRequest();
        }
        catch(Exception exUploader)
        {
            StatusLog.AddError("Aborted upload datasources. Unexpected error + " + exUploader.Message);
        }
    }