/// <summary> /// Adds the report properties. /// </summary> /// <param name="reportModelFiles"> /// The report server reports. /// </param> /// <param name="propertiesString"> /// The properties string. /// </param> private void AddModelProperties(ReportModelFiles reportModelFiles, string propertiesString) { string[] strings; foreach (string propertery in propertiesString.Split(new[] { ';' })) { strings = propertery.Split(new[] { '=' }); reportModelFiles.ReportServerProperties.Add(strings[0], strings[1]); } }
/// <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); } }