public void CreateSSRS_Project(string folder_To_Create, string Parent_Folder) { // SSRS_Deploy.ReportService2010.Property[] p = new SSRS_Deploy.ReportService2010.Property[1]; ReportingServices2010.Property[] properties = new ReportingServices2010.Property[2]; ReportingServices2010.Property p = new ReportingServices2010.Property(); p.Name = "Hidden"; p.Value = "false"; properties[0] = p; Property desc = new Property(); desc.Name = ""; desc.Value = ""; if (Parent_Folder == SSRS_Project) { desc.Name = "Description"; try { string Server = ConfigurationManager.ConnectionStrings["Connection_" + folder_To_Create].ConnectionString; // Console.WriteLine( Server.IndexOf("initial", 12) ); desc.Value = Server.Substring(12, Server.IndexOf("initial", 12) - 12 - 1); } catch { Console.WriteLine("Error In Folder Creation"); } } properties[1] = desc; // if(folder_To_Create.Contains("IPA") || folder_To_Create.Contains("CRA")) // { rs.CreateFolder(folder_To_Create, @"/" + Parent_Folder, properties); Console.WriteLine("Create Folder => " + folder_To_Create); // } }
public void CreateDataSource() { // string[] DataSources_To_Create = SSRS_DataSources.Split('#'); DataSourceDefinition[] DataSources = new DataSourceDefinition[DataSources_To_Create.Count()]; DataSourceDefinition Definition; int x = 0; foreach (string ds in DataSources_To_Create) { Definition = new DataSourceDefinition(); Definition.CredentialRetrieval = CredentialRetrievalEnum.Store; Definition.ConnectString = ConfigurationManager.ConnectionStrings["Connection_" + ds].ConnectionString; //"data source=NIBS;initial catalog=Books"; Definition.Enabled = true; Definition.UserName = ConfigurationManager.AppSettings["SSRS_UserName"]; Definition.Password = ConfigurationManager.AppSettings["SSRS_UserPassword"]; Definition.EnabledSpecified = false; Definition.Extension = "SQL"; Definition.ImpersonateUserSpecified = false; Definition.Prompt = null; Definition.WindowsCredentials = false; DataSources[x] = Definition; ReportingServices2010.Property[] properties = new ReportingServices2010.Property[2]; ReportingServices2010.Property p = new ReportingServices2010.Property(); p.Name = "Hidden"; p.Value = "true"; properties[0] = p; Property desc = new Property(); desc.Name = "Description"; string Server = ConfigurationManager.ConnectionStrings["Connection_" + ds].ConnectionString; desc.Value = Server.Substring(12, Server.IndexOf("initial", 12) - 12 - 1); properties[1] = desc; rs.CreateDataSource(@"Data_Source_" + ds, "/" + SSRS_Project, true, Definition, properties); Console.WriteLine("Created DataSource => " + "/" + SSRS_Project + @"/Data_Source_" + ds); x++; } Console.WriteLine(" "); }