/// <summary> /// The execute. /// </summary> /// <returns> /// The execute. /// </returns> public override bool Execute() { try { if (!this.IsIntergatedMode) { this.ReportServerUrl = R2DeploymentManger.GetNativeURL(this.ServerURL); } else { this.ReportServerUrl = R2DeploymentManger.GetSharepoint(this.ServerURL); } return(true); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "ReportServerUrl", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call MSBuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; try { return(r2DeploymentManger.DeleteReportDataSource( this.DataSourceName, this.Folder, this.DocumentLibraryURL)); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "DeleteDataSource", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call MSBuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; try { if (String.IsNullOrEmpty(this.FolderName)) { this.FolderName = "/"; } this.Exists = r2DeploymentManger.ReportItemExists( this.FolderName, ReportItemStrings.Folder, this.Folder, this.DocumentLibraryURL); return(true); } catch (Exception exception) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "ReportItemExists", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, exception.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call MSBuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; try { return(r2DeploymentManger.CreateFolder( this.NewFolderPath, this.DocumentLibraryURL, this.CreateReportFolderProperties(this.FolderReportProperties))); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "CreateReportFolder", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call MSBuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { // Connecting to the reporting server R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; try { return(r2DeploymentManger.AddReportUser(this.ReportUserName, this.ReportingRoles, this.Folder)); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "AddReportUser", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// When overridden in a derived class, executes the task. /// </summary> /// <returns> /// true if the task successfully executed; otherwise, false. /// </returns> public override bool Execute() { // Creates the new instances of the reporting services. // Use the current users windows credentials to connect to the report server. R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); ReportDataSet[] reportDataSets = new ReportDataSet[this.ShareDataSets.Length]; r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; try { // loop through the array of reports. for (int index = 0; index < this.ShareDataSets.Length; index++) { reportDataSets[index] = new ReportDataSet() { ShareDataSetName = this.ShareDataSets[index].GetMetadata("Filename"), ShareDataSetFilePath = this.ShareDataSets[index].GetMetadata("FullPath"), DataSource = this.ShareDataSets[index].GetMetadata("DataSource"), DateSetFolder = this.ShareDataSets[index].GetMetadata("Folder"), DocumentLibraryURL = string.IsNullOrEmpty(this.ShareDataSets[index].GetMetadata("ReportDataSetNames")) ? null : this.ShareDataSets[index].GetMetadata("DocumentLibraryURL") }; string propertiesString = this.ShareDataSets[index].GetMetadata("ReportServerProperties"); if (!string.IsNullOrEmpty(propertiesString)) { this.AddReportProperties(reportDataSets[index], propertiesString); } } return(r2DeploymentManger.UploadShareDataSets(reportDataSets, this.DisableWarnings)); } catch (Exception ex) { // catches the error and then reports out via msbuild. this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "AddReports", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call msbuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; ReportServerDataSource[] reportServerDataSources = new ReportServerDataSource[this.DataSources.Length]; try { // loop through the array of reports. for (int index = 0; index < this.DataSources.Length; index++) { reportServerDataSources[index] = new ReportServerDataSource { DataSourceFolder = this.DataSources[index].GetMetadata("Folder"), DocumentLibraryURL = string.IsNullOrEmpty(this.DataSources[index].GetMetadata("DocumentLibraryURL")) ? string.Empty : this.DataSources[index].GetMetadata("DocumentLibraryURL"), Name = this.DataSources[index].ItemSpec, ReportDataSourceNames = string.IsNullOrEmpty(this.DataSources[index].GetMetadata("ReportDataSourceNames")) ? null : this.DataSources[index].GetMetadata("ReportDataSourceNames").Split(new[] { ';' }) }; } return(r2DeploymentManger.SetReportDataSource( this.ReportItem, this.DocumentLibraryURL, this.Recursive, reportServerDataSources, this.UseMatchCase)); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "SetReportDataSource", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call MSBuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { // Creates the new instances of the reporting services. // Use the current users windows credentials to connect to the report server. R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); ReportResourceFile[] reportResourcesFile = new ReportResourceFile[this.Files.Length]; r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; try { // loop through the array of reports. for (int index = 0; index < this.Files.Length; index++) { reportResourcesFile[index] = new ReportResourceFile(this.Files[index].GetMetadata("FullPath")); reportResourcesFile[index].MimeType = this.Files[index].GetMetadata("MimeType"); reportResourcesFile[index].ReportServerProperties.Add( "MimeType", reportResourcesFile[index].MimeType); string propertiesString = this.Files[index].GetMetadata("ReportServerProperties"); if (!string.IsNullOrEmpty(propertiesString)) { this.AddFilesProperties(reportResourcesFile[index], propertiesString); } } return(r2DeploymentManger.UploadResource(reportResourcesFile, this.Folder, this.DocumentLibraryURL)); } catch (Exception ex) { // catches the error and then reports out via msbuild. this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "AddResources", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call MSBuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); ReportModelFiles[] reportModelsFiles = new ReportModelFiles[this.ReportModels.Length]; r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; try { for (int index = 0; index < this.ReportModels.Length; index++) { reportModelsFiles[index] = new ReportModelFiles( this.ReportModels[index].GetMetadata("FullPath"), this.ReportModels[index].GetMetadata("DataSourceFullPath"), this.ReportModels[index].GetMetadata("ModelName")); string propertiesString = this.ReportModels[index].GetMetadata("ReportServerProperties"); if (!string.IsNullOrEmpty(propertiesString)) { this.AddModelProperties(reportModelsFiles[index], propertiesString); } } return(r2DeploymentManger.UploadModel(reportModelsFiles, this.Folder, this.DisableWarnings)); } catch (Exception exception) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "AddReportsModel", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, exception.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute method which is call MSBuild to run the task /// </summary> /// <returns> /// <c>true</c> if successful ; otherwise, <c>false</c>. /// </returns> public override bool Execute() { string invaildDataourceMessage; // Connecting to the reporting server R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; ReportServerDataSource[] reportServerDataSources = new ReportServerDataSource[this.DataSources.Length]; try { // loop through the array of reports. for (int index = 0; index < this.DataSources.Length; index++) { if (!this.isDataSourceValid(this.DataSources[index], out invaildDataourceMessage)) { throw new Exception(invaildDataourceMessage); } reportServerDataSources[index] = new ReportServerDataSource { ConnectionString = this.DataSources[index].GetMetadata("ConnectionString"), DataSourceFolder = this.DataSources[index].GetMetadata("Folder"), Name = this.DataSources[index].ItemSpec, OverWrite = Convert.ToBoolean(this.DataSources[index].GetMetadata("OverWrite")), Provider = (DataProviderOprions) Enum.Parse( typeof(DataProviderOprions), this.DataSources[index].GetMetadata("Provider"), true) }; if (!String.IsNullOrEmpty(this.DataSources[index].GetMetadata("WindowsUser")) && !String.IsNullOrEmpty(this.DataSources[index].GetMetadata("WindowsUserPassword"))) { reportServerDataSources[index].WindowCredentials = new ReportServerDataSourceWindowsCredentials( this.DataSources[index].GetMetadata("WindowsUser"), this.DataSources[index].GetMetadata("WindowsUserPassWord")); } if (!string.IsNullOrEmpty(this.DataSources[index].GetMetadata("DocumentLibraryURL"))) { reportServerDataSources[index].DocumentLibraryURL = this.DataSources[index].GetMetadata("DocumentLibraryURL"); } string propertiesString = this.DataSources[index].GetMetadata("ReportServerProperties"); if (!string.IsNullOrEmpty(propertiesString)) { this.AddReportProperties(reportServerDataSources[index], propertiesString); } if (!String.IsNullOrEmpty(this.DataSources[index].GetMetadata("Prompt"))) { reportServerDataSources[index].CredentialsPrompt = this.DataSources[index].GetMetadata("Prompt"); } } return(r2DeploymentManger.CreateDataSource(reportServerDataSources)); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "CreateReportingDataSource", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// When overridden in a derived class, executes the task. /// </summary> /// <returns> /// true if the task successfully executed; otherwise, false. /// </returns> public override bool Execute() { R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; ReportSubscription[] reportSubscriptions = new ReportSubscription[this.Subscriptions.Length]; try { for (int i = 0; i < this.Subscriptions.Length; i++) { if (!string.IsNullOrEmpty(this.Subscriptions[i].GetMetadata("QueryText"))) { ReportDataSubscription reportDataSubscription = new ReportDataSubscription(); reportDataSubscription.Description = this.Subscriptions[i].GetMetadata( "SubscriptionDescription"); reportDataSubscription.ScheduleName = this.Subscriptions[i].GetMetadata("ReportScheduleName"); reportDataSubscription.DeliveryMethodOptions = RSBuildHelper.DeliveryMethodOption(this.Subscriptions[i].GetMetadata("DeliveryMethod")); RSBuildHelper.GetParameters( reportDataSubscription.ReportParameters, this.Subscriptions[i].GetMetadata("SubscriptionReportParamters"), reportDataSubscription.DeliveryMethodOptions); RSBuildHelper.GetParameters( reportDataSubscription.ExtensionSettings, this.Subscriptions[i].GetMetadata("SubscriptionSettings"), reportDataSubscription.DeliveryMethodOptions); reportDataSubscription.Reports.AddRange( this.Subscriptions[i].GetMetadata("SubscriptionReports").Split(new[] { ';' })); reportDataSubscription.SubscriptionQuery.QueryText = this.Subscriptions[i].GetMetadata("QueryText"); reportDataSubscription.SubscriptionQuery.Fields.AddRange( this.Subscriptions[i].GetMetadata("QueryFields").Split(new[] { ';' })); reportDataSubscription.SubscriptionQuery.ShareConnection = this.Subscriptions[i].GetMetadata("SubscriptionShareConnection"); RSBuildHelper.GetParameters( reportDataSubscription.ExtensionSettingsFieldReferences, this.Subscriptions[i].GetMetadata("SubscriptioSettingsFieldReferences"), reportDataSubscription.DeliveryMethodOptions); RSBuildHelper.GetParameters( reportDataSubscription.ReportFieldReferences, this.Subscriptions[i].GetMetadata("SubscriptionReportsFieldReferences"), reportDataSubscription.DeliveryMethodOptions); reportSubscriptions[i] = reportDataSubscription; } else { reportSubscriptions[i] = new ReportSubscription(); reportSubscriptions[i].Description = this.Subscriptions[i].GetMetadata( "SubscriptionDescription"); reportSubscriptions[i].ScheduleName = this.Subscriptions[i].GetMetadata("ReportScheduleName"); reportSubscriptions[i].DeliveryMethodOptions = RSBuildHelper.DeliveryMethodOption(this.Subscriptions[i].GetMetadata("DeliveryMethod")); RSBuildHelper.GetParameters( reportSubscriptions[i].ReportParameters, this.Subscriptions[i].GetMetadata("SubscriptionReportParamters"), reportSubscriptions[i].DeliveryMethodOptions); RSBuildHelper.GetParameters( reportSubscriptions[i].ExtensionSettings, this.Subscriptions[i].GetMetadata("SubscriptionSettings"), reportSubscriptions[i].DeliveryMethodOptions); reportSubscriptions[i].Reports.AddRange( this.Subscriptions[i].GetMetadata("SubscriptionReports").Split(new[] { ';' })); } } return(r2DeploymentManger.CreateSubscrptions( reportSubscriptions, this.ReportingSite, this.DeleteExistingSubscriptions, this.DeployIfExistingSubscriptions)); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "CreateSubscriptions", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }
/// <summary> /// The execute. /// </summary> /// <returns> /// The execute. /// </returns> /// <exception cref="Exception"> /// </exception> /// <exception cref="FormatException"> /// </exception> public override bool Execute() { R2DeploymentManger r2DeploymentManger = new R2DeploymentManger(this.ReportServerURL); r2DeploymentManger.DeploymentMangerMessages += this.deploymentMangerMessages; ReportSchedule[] reportSchedules = new ReportSchedule[this.ReportSchedules.Length]; string invaildReportScheduleMessage; DateTime reportScheduleDateTime; try { for (int index = 0; index < this.ReportSchedules.Length; index++) { if (!this.isVaildReportSchedule(this.ReportSchedules[index], out invaildReportScheduleMessage)) { throw new Exception(invaildReportScheduleMessage); } reportSchedules[index] = new ReportSchedule(); reportSchedules[index].Name = this.ReportSchedules[index].ItemSpec; if ( !DateTime.TryParse( this.ReportSchedules[index].GetMetadata("StartDateTime"), out reportScheduleDateTime)) { throw new FormatException( string.Format( "Report Schedule {0} StartDateTime is not vaild ", this.ReportSchedules[index].ItemSpec)); } reportSchedules[index].StartDateTime = reportScheduleDateTime; if (!string.IsNullOrEmpty(this.ReportSchedules[index].GetMetadata("EndDateTime"))) { if ( !DateTime.TryParse( this.ReportSchedules[index].GetMetadata("EndDateTime"), out reportScheduleDateTime)) { throw new FormatException( string.Format( "Report Schedule {0} EndDateTime is not vaild ", this.ReportSchedules[index].ItemSpec)); } reportSchedules[index].EndDateTime = reportScheduleDateTime; } reportSchedules[index].ScheduleRecurrence = (ScheduleRecurrenceOptions) Enum.Parse( typeof(ScheduleRecurrenceOptions), this.ReportSchedules[index].GetMetadata("ScheduleRecurrence"), true); switch (reportSchedules[index].ScheduleRecurrence) { case ScheduleRecurrenceOptions.Min: case ScheduleRecurrenceOptions.Daily: reportSchedules[index].Interval = this.ReportSchedules[index].GetMetadata("Interval"); break; case ScheduleRecurrenceOptions.Weekly: this.GetDaysOfWeek( reportSchedules[index].Days, this.ReportSchedules[index].GetMetadata("DaysOfWeek")); if (!string.IsNullOrEmpty(this.ReportSchedules[index].GetMetadata("Interval"))) { reportSchedules[index].Interval = this.ReportSchedules[index].GetMetadata("Interval"); } break; case ScheduleRecurrenceOptions.Monthly: this.GetMonthsOfYear( reportSchedules[index].Months, this.ReportSchedules[index].GetMetadata("MonthsOfYear")); if (!string.IsNullOrEmpty(this.ReportSchedules[index].GetMetadata("Interval"))) { reportSchedules[index].Interval = this.ReportSchedules[index].GetMetadata("Interval"); } break; case ScheduleRecurrenceOptions.MonthlyDOW: this.GetDaysOfWeek( reportSchedules[index].Days, this.ReportSchedules[index].GetMetadata("DaysOfWeek")); this.GetMonthsOfYear( reportSchedules[index].Months, this.ReportSchedules[index].GetMetadata("MonthsOfYear")); if (!string.IsNullOrEmpty(this.ReportSchedules[index].GetMetadata("Interval"))) { reportSchedules[index].Interval = this.ReportSchedules[index].GetMetadata("Interval"); } break; } } return(r2DeploymentManger.CreateSchedules(reportSchedules, this.ReportingSite)); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "CreateReportSchedule", this.BuildEngine.ProjectFileOfTaskNode, this.BuildEngine.LineNumberOfTaskNode, this.BuildEngine.ColumnNumberOfTaskNode, 0, 0, ex.Message, string.Empty, this.ToString())); return(false); } }