Search results
Suggest a FeaturePDF

How to manage reports within application using Bold Reports® Report Designer

You can use ExternalServer to manage the reports with in application. Find the following code for accessing the existing reports, datasources and datasets from application App_Data folder.

public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type)
        {
            List<CatalogItem> _items = new List<CatalogItem>();
            string targetFolder = HttpContext.Current.Server.MapPath("~/") + @"App_Data\ReportServer\";

            if (type == ItemTypeEnum.Folder || type == ItemTypeEnum.Report)
            {
                targetFolder = targetFolder + @"Report\";
                if (!(string.IsNullOrEmpty(folderName) || folderName.Trim() == "/"))
                {
                    targetFolder = targetFolder + folderName;
                }
            }

            if (type == ItemTypeEnum.DataSet)
            {
                foreach (var file in Directory.GetFiles(targetFolder + "DataSet"))
                {
                    CatalogItem catalogItem = new CatalogItem();
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);
                    catalogItem.Type = ItemTypeEnum.DataSet;
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
                    _items.Add(catalogItem);
                }
            }
            else if (type == ItemTypeEnum.DataSource)
            {
                foreach (var file in Directory.GetFiles(targetFolder + "DataSource"))
                {
                    CatalogItem catalogItem = new CatalogItem();
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);
                    catalogItem.Type = ItemTypeEnum.DataSource;
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
                    _items.Add(catalogItem);
                }
            }
            else if (type == ItemTypeEnum.Folder)
            {
                foreach (var file in Directory.GetDirectories(targetFolder))
                {
                    CatalogItem catalogItem = new CatalogItem();
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);
                    catalogItem.Type = ItemTypeEnum.Folder;
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
                    _items.Add(catalogItem);
                }
            }
            else if (type == ItemTypeEnum.Report)
            {
                foreach (var file in Directory.GetFiles(targetFolder, "*.rdl"))
                {
                    CatalogItem catalogItem = new CatalogItem();
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);
                    catalogItem.Type = ItemTypeEnum.Report;
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
                    _items.Add(catalogItem);
                }
            }

            return _items;
        }

You can refer the below application for using the ExternalServer ExternalServer Sample

Having trouble getting help?
Contact Support
Having trouble getting help?
Contact Support