コード例 #1
0
        public RSCatalogItem CreateFolder(string Folder, string Parent, RSProperty[] Properties)
        {
            Property[]  props   = ((Property[])Converter.Convert(Properties));
            CatalogItem catalog = rs.CreateFolder(Folder, Parent, props);

            return((RSCatalogItem)Converter.Convert(catalog));
        }
コード例 #2
0
        private void CreateParentFolder(string parentFolder)
        {
            var items = rs.ListChildren("/", false);
            var parentFolderExists = items.Any(catalogItem =>
                                               catalogItem.Name.ToUpperInvariant() == parentFolder.ToUpperInvariant() &&
                                               catalogItem.TypeName.ToUpperInvariant() == "FOLDER");

            if (parentFolderExists)
            {
                Log("Folder '{0}' already exists", parentFolder);
            }
            else
            {
                Log("Creating folder '{0}'", parentFolder);
                rs.CreateFolder(parentFolder, "/", null);
                Log("Created folder '{0}'", parentFolder);
            }
        }
コード例 #3
0
        private void CreateFoldersIfNotExists(string analysisFolderName, string parentFolderName, string reportingServerUrl)
        {
            using (ReportingService2010 rs = new ReportingService2010())
            {
                rs.Credentials = CredentialCache.DefaultCredentials;
                rs.Url         = string.Format("{0}/ReportService2010.asmx?wsdl", reportingServerUrl);

                string parentFolderExist = rs.GetItemType(string.Format(@"/{0}", parentFolderName));

                if (!parentFolderExist.Equals(parentFolderType, StringComparison.OrdinalIgnoreCase))
                {
                    rs.CreateFolder(parentFolderName, $"/", null);
                }

                string analysisFolderExist = rs.GetItemType(string.Format(@"/{0}/{1}", parentFolderName, analysisFolderName));
                if (!analysisFolderExist.Equals(parentFolderType, StringComparison.OrdinalIgnoreCase))
                {
                    rs.CreateFolder(analysisFolderName, $"/{parentFolderName}", null);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Creates the folder structure of a given path. This will go through each folder in the path and create it.
        /// </summary>
        /// <param name="reportingService">The reporting service.</param>
        /// <param name="path">The path.</param>
        /// <exception cref="System.ArgumentNullException">reportingService</exception>
        private static void CreateFolderFromPath(ReportingService2010 reportingService, string path)
        {
            if (reportingService == null)
            {
                throw new ArgumentNullException("reportingService");
            }

            string [] folders = path.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

            string parentPath = "/";

            foreach (string folder in folders)
            {
                string folderPath;

                if (parentPath != "/" && parentPath.EndsWith("/"))
                {
                    parentPath = parentPath.Substring(0, parentPath.LastIndexOf("/"));
                }

                if (parentPath == "/")
                {
                    folderPath = parentPath + folder;
                }
                else
                {
                    folderPath = parentPath + "/" + folder;
                }

                if (!ReportingService2010TestEnvironment.ItemExists(reportingService, folderPath, "Folder"))
                {
                    reportingService.CreateFolder(folder, parentPath, null);
                }

                if (parentPath != "/")
                {
                    parentPath += "/" + folder;
                }
                else
                {
                    parentPath += folder;
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Create Folder to place our report on Root directory
        /// </summary>
        /// <param name="client"></param>
        /// <param name="folderName"></param>
        private static void CreateFolder(ReportingService2010 client, string folderName)
        {
            var propArray = new Property[1];

            propArray[0] = new Property()
            {
                Value = folderName,
                Name  = folderName
            };

            //User credential for
            //Reporting Service
            //the current logged system user
            var catalogItems = client.ListChildren("/", true);

            if (catalogItems.FirstOrDefault(s => s.Name == folderName) == null)
            {
                client.CreateFolder(folderName, "/", propArray);
            }
        }
コード例 #6
0
        public string CreateFolder(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, string folderName)
        {
            string      objReturn = string.Empty;
            CatalogItem objTemp   = null;

            try
            {
                if (rsMain == null)
                {
                    rsMain = new ReportingService2010()
                    {
                        Url = ReportServiceUrl, Credentials = System.Net.CredentialCache.DefaultCredentials
                    }
                }
                ;

                if (!CheckItemExists("Folder", "/Reports/" + folderName))
                {
                    LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                    objTemp = rsMain.CreateFolder(folderName, "/Reports", null);
                    LogManager.LogTiming(logDetails);

                    if (objTemp != null)
                    {
                        objReturn = "/Reports/" + folderName;
                    }
                }
                else
                {
                    objReturn = "/Reports/" + folderName;
                }
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }

            return(objReturn);
        }
コード例 #7
0
 public void CreateFolder(string folder, string parent, string properties)
 {
     webserviceProxy.CreateFolder(folder, parent, null);
 }
コード例 #8
0
        private void ImportReports()
        {
            this.Cursor = Cursors.WaitCursor;
            string connectionString = ConfigurationManager.ConnectionStrings["SQL_PTO_Report.Properties.Settings.SQLPTOConnectionString"].ConnectionString;

            //Create SQLPTO Data Source
            ReportingService2010 rs = new ReportingService2010();

            rs.Url         = SSRSWS;
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

            try
            {
                rs.CreateFolder("Data Sources", @"/", null);
            }
            catch { }

            try
            {
                rs.CreateFolder("SQLPTOReports", @"/", null);
            }
            catch { }

            try
            {
                rs.CreateFolder("SQLPTOSummaryReports", @"/", null);
            }
            catch { }

            DataSourceDefinition definition = new DataSourceDefinition();

            definition.CredentialRetrieval      = CredentialRetrievalEnum.Integrated;
            definition.ConnectString            = "Data Source=" + SqlServer + ";Initial Catalog=SQLPTO";
            definition.Enabled                  = true;
            definition.EnabledSpecified         = true;
            definition.Extension                = "SQL";
            definition.ImpersonateUser          = false;
            definition.ImpersonateUserSpecified = true;
            definition.Prompt             = null;
            definition.WindowsCredentials = false;

            rs.CreateDataSource("SQLPTO", @"/Data Sources", true, definition, null);

            //Create SQLPTOSummary Data Source

            DataSourceDefinition definitionsum = new DataSourceDefinition();

            definitionsum.CredentialRetrieval      = CredentialRetrievalEnum.Integrated;
            definitionsum.ConnectString            = "Data Source=" + SqlServer + ";Initial Catalog=SQLPTOSummary";
            definitionsum.Enabled                  = true;
            definitionsum.EnabledSpecified         = true;
            definitionsum.Extension                = "SQL";
            definitionsum.ImpersonateUser          = false;
            definitionsum.ImpersonateUserSpecified = true;
            definitionsum.Prompt             = null;
            definitionsum.WindowsCredentials = false;

            rs.CreateDataSource("SQLPTOsummary", @"/Data Sources", true, definitionsum, null);


            //Create reports
            // Open the report (rdl) file and
            // read the data into the stream.
            DeployReportItems(@".\Reports\SQLPTOSummaryReports", @"/SQLPTOSummaryReports", @"/Data Sources/SQLPTOSummary");
            DeployReportItems(@".\Reports\SQLPTOReports", @"/SQLPTOReports", @"/Data Sources/SQLPTO");
            rs.Dispose();

            MessageBox.Show("Reports imported successfully!");

            this.Cursor = Cursors.Default;
        }
コード例 #9
0
ファイル: ReportHelper.cs プロジェクト: banban/SSRS-Tool
        private void CheckLinkedFolderExists(ReportingService2010.ReportingService2010SoapClient rsService
            , ReportingService2010.TrustedUserHeader trusteduserHeader
            , ReportingService2010.SearchCondition condition
            , ReportingService2010.SearchCondition[] conditions
            , string linkedReportFolderPath
            )
        {
            string parentFolderPath = @"/";
            string[] folders = linkedReportFolderPath.Split('/');
            for (int i = 0; i < folders.Length; i++)
            {
                if (!string.IsNullOrEmpty(folders[i]))
                {
                    ReportingService2010.CatalogItem[] foundItems = null;
                    condition.Values = new string[] { folders[i] };
                    rsService.FindItems(trusteduserHeader
                        , parentFolderPath
                        , ReportingService2010.BooleanOperatorEnum.And
                        , new ReportingService2010.Property[0]
                        , conditions
                        , out foundItems);

                    if (foundItems == null || (foundItems != null && foundItems.Count() == 0))
                    {
                        ReportingService2010.CatalogItem linkedFolder = new ReportingService2010.CatalogItem();
                        rsService.CreateFolder(trusteduserHeader
                            , folders[i]
                            , parentFolderPath
                            , new ReportingService2010.Property[0]
                            , out linkedFolder
                            );
                    }
                    parentFolderPath = parentFolderPath.TrimEnd('/') + @"/" + folders[i];
                }
            }
        }