/// <summary> /// Attempts to upload a single file a Tableau Server, and then make it a published workbook /// </summary> /// <param name="localFilePath"></param> /// <returns></returns> private bool AttemptUploadSingleFile_Inner( string localFilePath, string projectId, CredentialManager.Credential dbCredentials, WorkbookPublishSettings publishSettings) { string uploadSessionId; try { var fileUploader = new UploadFile(_onlineUrls, _onlineSession, localFilePath, _uploadChunkSizeBytes, _uploadChunkDelaySeconds); uploadSessionId = fileUploader.ExecuteRequest(); } catch (Exception exFileUpload) { this.StatusLog.AddError("Unexpected error attempting to upload file " + localFilePath + ", " + exFileUpload.Message); throw exFileUpload; } SiteWorkbook workbook; this.StatusLog.AddStatus("File chunks upload successful. Next step, make it a published workbook", -10); try { string fileName = Path.GetFileNameWithoutExtension(localFilePath); string uploadType = RemoveFileExtensionDot(Path.GetExtension(localFilePath).ToLower()); workbook = FinalizePublish( uploadSessionId, FileIOHelper.Undo_GenerateWindowsSafeFilename(fileName), //[2016-05-06] If the name has escapted characters, unescape them uploadType, projectId, dbCredentials, publishSettings); StatusLog.AddStatus("Upload content details: " + workbook.ToString(), -10); StatusLog.AddStatus("Success! Uploaded workbook " + Path.GetFileName(localFilePath)); } catch (Exception exPublishFinalize) { this.StatusLog.AddError("Unexpected error finalizing publish of file " + localFilePath + ", " + exPublishFinalize.Message); LogManualAction_UploadWorkbook(localFilePath); throw exPublishFinalize; } //See if we want to reassign ownership of the workbook if (_attemptOwnershipAssignment) { try { AttemptOwnerReassignment(workbook, publishSettings, _siteUsers); } catch (Exception exOwnershipAssignment) { this.StatusLog.AddError("Unexpected error reassigning ownership of published workbook " + workbook.Name + ", " + exOwnershipAssignment.Message); LogManualAction_ReassignOwnership(workbook.Name); throw exOwnershipAssignment; } } return(true); //Success }
/// <summary> /// Attempts to upload a single file a Tableau Server, and then make it a published workbook /// </summary> /// <param name="localFilePath"></param> /// <returns></returns> private bool AttemptUploadSingleFile_Inner( string localFilePath, string projectId, CredentialManager.Credential dbCredentials) { string uploadSessionId; try { var fileUploader = new UploadFile(_onlineUrls, _onlineSession, localFilePath, _uploadChunkSizeBytes, _uploadChunkDelaySeconds); uploadSessionId = fileUploader.ExecuteRequest(); } catch (Exception exFileUpload) { this.StatusLog.AddError("Unexpected error attempting to upload file " + localFilePath + ", " + exFileUpload.Message); throw exFileUpload; } this.StatusLog.AddStatus("File chunks upload successful. Next step, make it a published workbook", -10); try { string fileName = Path.GetFileNameWithoutExtension(localFilePath); string uploadType = RemoveFileExtensionDot(Path.GetExtension(localFilePath).ToLower()); var workbook = FinalizePublish(uploadSessionId, fileName, uploadType, projectId, dbCredentials); StatusLog.AddStatus("Upload content details: " + workbook.ToString(), -10); StatusLog.AddStatus("Success! Uploaded workbook " + Path.GetFileName(localFilePath)); } catch (Exception exPublishFinalize) { this.StatusLog.AddError("Unexpected error finalizing publish of file " + localFilePath + ", " + exPublishFinalize.Message); LogManualAction_UploadWorkbook(localFilePath); throw exPublishFinalize; } return(true); //Success }
/// <summary> /// Attempts to upload a single file a Tableau Server, and then make it a published data source /// </summary> /// <param name="localFilePath"></param> /// <param name="projectId"></param> /// <param name="dbCredentials">If not NULL, then these are the DB credentials we want to associate with the content we are uploading</param> /// <returns></returns> private bool AttemptUploadSingleFile( string localFilePath, string projectId, CredentialManager.Credential dbCredentials) { string uploadSessionId; try { var fileUploader = new UploadFile(_onlineUrls, _onlineSession, localFilePath, _uploadChunkSizeBytes, _uploadChunkDelaySeconds); uploadSessionId = fileUploader.ExecuteRequest(); } catch (Exception exFileUpload) { this.StatusLog.AddError("Unexpected error attempting to upload file " + localFilePath + ", " + exFileUpload.Message); throw exFileUpload; } this.StatusLog.AddStatus("File chunks upload successful. Next step, make it a published datasource", -10); try { string fileName = Path.GetFileNameWithoutExtension(localFilePath); string uploadType = RemoveFileExtensionDot(Path.GetExtension(localFilePath).ToLower()); var dataSource = FinalizePublish( uploadSessionId, FileIOHelper.Undo_GenerateWindowsSafeFilename(fileName), //[2016-05-06] If the name has escapted characters, unescape them uploadType, projectId, dbCredentials); StatusLog.AddStatus("Upload content details: " + dataSource.ToString(), -10); StatusLog.AddStatus("Success! Uploaded datasource " + Path.GetFileName(localFilePath)); } catch (Exception exPublishFinalize) { this.StatusLog.AddError("Unexpected error finalizing publish of file " + localFilePath + ", " + exPublishFinalize.Message); throw exPublishFinalize;; } return(true); //Success }
/// <summary> /// Attempts to upload a single file a Tableau Server, and then make it a published workbook /// </summary> /// <param name="localFilePath"></param> /// <returns></returns> private bool AttemptUploadSingleFile_Inner( string localFilePath, string projectId, CredentialManager.Credential dbCredentials, WorkbookPublishSettings publishSettings) { string uploadSessionId; try { var fileUploader = new UploadFile(_onlineUrls, _onlineSession, localFilePath, _uploadChunkSizeBytes, _uploadChunkDelaySeconds); uploadSessionId = fileUploader.ExecuteRequest(); } catch (Exception exFileUpload) { this.StatusLog.AddError("Unexpected error attempting to upload file " + localFilePath + ", " + exFileUpload.Message); throw exFileUpload; } SiteWorkbook workbook; this.StatusLog.AddStatus("File chunks upload successful. Next step, make it a published workbook", -10); try { string fileName = Path.GetFileNameWithoutExtension(localFilePath); string uploadType = RemoveFileExtensionDot(Path.GetExtension(localFilePath).ToLower()); workbook = FinalizePublish( uploadSessionId, FileIOHelper.Undo_GenerateWindowsSafeFilename(fileName), //[2016-05-06] If the name has escapted characters, unescape them uploadType, projectId, dbCredentials, publishSettings); StatusLog.AddStatus("Upload content details: " + workbook.ToString(), -10); StatusLog.AddStatus("Success! Uploaded workbook " + Path.GetFileName(localFilePath)); } catch (Exception exPublishFinalize) { this.StatusLog.AddError("Unexpected error finalizing publish of file " + localFilePath + ", " + exPublishFinalize.Message); LogManualAction_UploadWorkbook(localFilePath); throw exPublishFinalize; } //See if we want to reassign ownership of the workbook if(_attemptOwnershipAssignment) { try { AttemptOwnerReassignment(workbook, publishSettings, _siteUsers); } catch (Exception exOwnershipAssignment) { this.StatusLog.AddError("Unexpected error reassigning ownership of published workbook " + workbook.Name + ", " + exOwnershipAssignment.Message); LogManualAction_ReassignOwnership(workbook.Name); throw exOwnershipAssignment; } } return true; //Success }
/// <summary> /// Attempts to upload a single file a Tableau Server, and then make it a published workbook /// </summary> /// <param name="localFilePath"></param> /// <returns></returns> private bool AttemptUploadSingleFile_Inner( string localFilePath, string projectId, CredentialManager.Credential dbCredentials) { string uploadSessionId; try { var fileUploader = new UploadFile(_onlineUrls, _onlineSession, localFilePath, _uploadChunkSizeBytes, _uploadChunkDelaySeconds); uploadSessionId = fileUploader.ExecuteRequest(); } catch (Exception exFileUpload) { this.StatusLog.AddError("Unexpected error attempting to upload file " + localFilePath + ", " + exFileUpload.Message); throw exFileUpload; } this.StatusLog.AddStatus("File chunks upload successful. Next step, make it a published workbook", -10); try { string fileName = Path.GetFileNameWithoutExtension(localFilePath); string uploadType = RemoveFileExtensionDot(Path.GetExtension(localFilePath).ToLower()); var workbook = FinalizePublish(uploadSessionId, fileName, uploadType, projectId, dbCredentials); StatusLog.AddStatus("Upload content details: " + workbook.ToString(), -10); StatusLog.AddStatus("Success! Uploaded workbook " + Path.GetFileName(localFilePath)); } catch (Exception exPublishFinalize) { this.StatusLog.AddError("Unexpected error finalizing publish of file " + localFilePath + ", " + exPublishFinalize.Message); LogManualAction_UploadWorkbook(localFilePath); throw exPublishFinalize; } return true; //Success }