UploadResource() публичный Метод

Uploads new .rdl file to SSRS
public UploadResource ( string resourceName, string filePath, string serverFolder, bool overwrite ) : IEnumerable
resourceName string
filePath string
serverFolder string
overwrite bool
Результат IEnumerable
Пример #1
0
        private static void ProcessDirectory(string directory, string serverFolder, string url, bool overwrite)
        {
            var uploader = new ReportingServicesUploader();

            uploader.ReportingServicesWebServiceUrl = string.Format("{0}", url);

            IList <System.IO.FileInfo> files = new List <System.IO.FileInfo>();

            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(directory);
            foreach (var file in dir.GetFiles("*.rds"))
            {
                files.Add(file);
            }
            foreach (var file in dir.GetFiles())
            {
                if (file.Extension.ToLowerInvariant() != ".rds")
                {
                    files.Add(file);
                }
            }

            foreach (var file in files)
            {
                Console.WriteLine("Processing file {0}", file.Name);
                string reportName             = file.Name.Remove(file.Name.Length - 4);
                IEnumerable <string> warnings = null;
                switch (file.Extension.ToLowerInvariant())
                {
                case ".bmp":
                case ".jpg":
                case ".png":
                    warnings = uploader.UploadResource(file.Name, file.FullName, serverFolder, overwrite);
                    break;

                case ".rds":
                    warnings = uploader.UploadDataSource(file.FullName, serverFolder, overwrite);
                    break;

                case ".rdl":
                    warnings = uploader.UploadReport(file.Name.Remove(file.Name.Length - 4), file.FullName, serverFolder, overwrite);
                    break;

                default:
                    Console.WriteLine("\tFile type unknown.  Skipping");
                    break;
                }

                if (warnings != null)
                {
                    foreach (var warning in warnings)
                    {
                        Console.Error.WriteLine("\tWarning: {0}", warning);
                    }
                }
            }
        }
        private static void ProcessDirectory(string directory, string serverFolder, string url, bool overwrite)
        {
            var uploader = new ReportingServicesUploader();
            uploader.ReportingServicesWebServiceUrl = string.Format("{0}", url);

            IList<System.IO.FileInfo> files = new List<System.IO.FileInfo>();
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(directory);
            foreach (var file in dir.GetFiles("*.rds"))
                files.Add(file);
            foreach (var file in dir.GetFiles())
                if (file.Extension.ToLowerInvariant() != ".rds")
                    files.Add(file);

            foreach (var file in files) {
                Console.WriteLine("Processing file {0}", file.Name);
                string reportName = file.Name.Remove(file.Name.Length - 4);
                IEnumerable<string> warnings = null;
                switch (file.Extension.ToLowerInvariant()) {
                    case ".bmp":
                    case ".jpg":
                    case ".png":
                        warnings = uploader.UploadResource(file.Name, file.FullName, serverFolder, overwrite);
                        break;
                    case ".rds":
                        warnings = uploader.UploadDataSource(file.FullName, serverFolder, overwrite);
                        break;
                    case ".rdl":
                        warnings = uploader.UploadReport(file.Name.Remove(file.Name.Length - 4), file.FullName, serverFolder, overwrite);
                        break;
                    default:
                        Console.WriteLine("\tFile type unknown.  Skipping");
                        break;
                }

                if (warnings != null)
                    foreach (var warning in warnings)
                        Console.Error.WriteLine("\tWarning: {0}", warning);
            }
        }