/// <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 IntegratedDeploymentManager integratedDeploymentManager = new IntegratedDeploymentManager(this.SharePointSiteUrl); integratedDeploymentManager.DeploymentMangerMessages += this.deploymentMangerMessages; try { return(integratedDeploymentManager.DeleteReportUser(this.ReportUserName, this.Folder)); } catch (Exception ex) { this.BuildEngine.LogErrorEvent( new BuildErrorEventArgs( "Reporting", "DeleteReportUser", 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() { IntegratedDeploymentManager integratedDeploymentManager = new IntegratedDeploymentManager(this.SharePointSiteUrl); integratedDeploymentManager.DeploymentMangerMessages += this.deploymentMangerMessages; try { if (String.IsNullOrEmpty(this.Folder)) { this.Folder = "/"; } this.Exists = integratedDeploymentManager.ReportItemExists( this.Folder, this.DataSourceName, IntegratedDeploymentManager.GetReportItemtype("DataSource")); 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() { // Creates the new instances of the reporting services. // Use the current users windows credentials to connect to the report server. IntegratedDeploymentManager integratedDeploymentManager = new IntegratedDeploymentManager(this.SharePointSiteUrl); ReportResourceFile[] reportResourcesFile = new ReportResourceFile[this.Files.Length]; integratedDeploymentManager.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"); string propertiesString = this.Files[index].GetMetadata("ReportServerProperties"); if (!string.IsNullOrEmpty(propertiesString)) { this.AddFilesProperties(reportResourcesFile[index], propertiesString); } } return(integratedDeploymentManager.UploadResource(reportResourcesFile, this.Folder)); } 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() { IntegratedDeploymentManager integratedDeploymentManager = new IntegratedDeploymentManager(this.SharePointSiteUrl); integratedDeploymentManager.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"), Name = this.DataSources[index].ItemSpec, ReportDataSourceNames = string.IsNullOrEmpty(this.DataSources[index].GetMetadata("ReportDataSourceNames")) ? null : this.DataSources[index].GetMetadata("ReportDataSourceNames").Split(new[] { ';' }) }; } return(integratedDeploymentManager.SetReportDataSource( this.ReportItem, 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() { IntegratedDeploymentManager integratedDeploymentManager = new IntegratedDeploymentManager(this.SharePointSiteUrl); ReportModelFiles[] reportModelsFiles = new ReportModelFiles[this.ReportModels.Length]; integratedDeploymentManager.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(integratedDeploymentManager.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 IntegratedDeploymentManager integratedDeploymentManager = new IntegratedDeploymentManager(this.SharePointSiteUrl); integratedDeploymentManager.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")); } string propertiesString = this.DataSources[index].GetMetadata("ReportServerProperties"); if (!string.IsNullOrEmpty(propertiesString)) { this.AddReportProperties(reportServerDataSources[index], propertiesString); } } return(integratedDeploymentManager.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); } }