/// <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);
}
}