UploadWorkbooks.ExecuteRequest C# (CSharp) Method

ExecuteRequest() public method

Upload all the workbook files
public ExecuteRequest ( ) : void
return void
    public void ExecuteRequest()
    {
        //Helper object to track project Ids and create projects as needed
        var projectListHelper = new ProjectFindCreateHelper(_onlineUrls, this._onlineSession, _uploadProjectBehavior);

        var statusLog = this.StatusLog;
        int countSuccess = 0;
        int countFailure = 0;

        statusLog.AddStatus("Uploading workbooks");
        UploadDirectoryToServer(_localUploadPath, _localUploadPath, projectListHelper, true, out countSuccess, out countFailure);
        this.StatusLog.AddStatus("Workbooks upload done.  Success: " + countSuccess.ToString() + ", Failure: " + countFailure.ToString());
    }

Usage Example

Example #1
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="credentialManager">Database credentials to associate with content we are uploading</param>
    private void Execute_UploadWorkbooks(
        TableauServerSignIn onlineLogin,
        string localBasePath,
        bool remapWorkbookReferences,
        CredentialManager credentialManager)
    {
        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,
            this.UploadChunksSizeBytes,
            this.UploadChunksDelaySeconds);

        try
        {
            dsUploader.ExecuteRequest();
        }
        catch (Exception exUploader)
        {
            StatusLog.AddError("Aborted upload workbooks. Unexpected error + " + exUploader.Message);
        }
    }
All Usage Examples Of UploadWorkbooks::ExecuteRequest