Example #1
0
        protected void UploadFile(string file, string destinationFolder, string server)
        {
            var path   = fileService.ExpandFileNamePath(file);
            var parent = path == null ? destinationFolder : String.Format("{0}/{1}", destinationFolder, path);
            var name   = fileService.GetFileName(file);

            logger.Info("Uploading file '{0}' to '{1}/{2}' on report server '{3}'", file, parent, name, server);

            try
            {
                channel.CreateCatalogItem(new CreateCatalogItemRequest
                {
                    Definition = fileService.GetBytes(file),
                    Name       = name,
                    Parent     = parent,
                    ItemType   = ItemType.Report,
                    Overwrite  = true
                });
            }
            catch (EndpointNotFoundException ex)
            {
                throw new InvalidParameterException(ex, $"There was no response from '{server}'");
            }

            var itemPath = String.Format("{0}/{1}", parent, name);

            UpdateDatasources(itemPath, destinationFolder);
        }
Example #2
0
        protected void UploadFile(string file, string destinationFolder, string server)
        {
            var path   = fileService.ExpandFileNamePath(file);
            var parent = path == null ? destinationFolder : String.Format("{0}/{1}", destinationFolder, path);
            var name   = fileService.GetFileName(file);

            logger.Info("Uploading file '{0}' to '{1}/{2}' on report server '{3}'", file, parent, name, server);

            channel.CreateCatalogItem(new CreateCatalogItemRequest
            {
                Definition = fileService.GetBytes(file),
                Name       = name,
                Parent     = parent,
                ItemType   = ItemType.Report,
                Overwrite  = true
            });

            var itemPath = String.Format("{0}/{1}", parent, name);

            UpdateDatasources(itemPath, destinationFolder);
        }