Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the FileExtensionsToUpload parameter to control which file type… #323

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

selsine
Copy link

@selsine selsine commented Feb 18, 2021

Added the FileExtensionsToUpload parameter to Write-RsFolderContent in order control which file type from the folder are uploaded.

Changes proposed in this pull request:

  • Added the FileExtensionsToUpload parameter toWrite-RsFolderContent in order control which file type from the folder are uploaded. This is useful when the Reports and Data Sources are in the same folder on disk, but need to uploaded to different folders on the server
  • Items that are not uploaded are logged used Write-Verbose so the user knows which items are skipped

For Example

Write-RsFolderContent -ReportServerUri 'http://localhost/reportserver_sql2012' -Path c:\Reports -RsFolder '/monthlyReports' -FileExtensionsToUpload @(".rsdl")

Write-RsFolderContent -ReportServerUri 'http://localhost/reportserver_sql2012' -Path c:\Reports -RsFolder '/dataSources' -FileExtensionsToUpload @(".rsds", ".rsd", ".rds")

How to test this code:

  • If FileExtensionsToUpload is not specified the Write-RsFolderContent command should function as normal uploading all previously valid file types: ".rdl", ".rsds", ".rsd", ".rds", ".jpg", ".jpeg", ".png"
  • if FileExtensionsToUpload is specified only items whose extension is contained within the array will be uploaded:
    -FileExtensionsToUpload @(".rsds", ".rsd", ".rds")

Has been tested on (remove any that don't apply):

  • Powershell 5
  • Windows 10
  • SQL Server 2016

(This is my first powershell-based pull-request so please let me know if my style is off in anyway or if this isn't something wanted in the main branch, this is a feature that I needed to automate our deployment)

@ghost
Copy link

ghost commented Feb 18, 2021

CLA assistant check
All CLA requirements met.

@SQLvariant
Copy link
Contributor

Added the FileExtensionsToUpload parameter to control which file type from the folder are uploaded.

Could you add an example or two so that the intended use/benefit is a little more clear?

@selsine
Copy link
Author

selsine commented Mar 11, 2021

@SQLvariant - Did you mean in the comment above?

In general I needed this because our RDL and RDS files are in the same location locally, but need to be deployed to different locations on the server.

By default Write-RsFolderContent takes Data Sources and Reports and assumes that they have to go in the same directory. Or assumes that if you want to update your Reports you also want to update your Data Sources.

It can also help to address another issue where you will get warnings if the Data Sources are not uploaded to the server before the Reports.

I had to move to slightly different approach and used Write-RsFolderContent as an example for my own function. I needed a callback for each item that was uploaded in order to update the each Data Source's connection credentials and update each report's Data Source Reference with the correct path on the server after they were uploaded.

@SQLvariant
Copy link
Contributor

@SQLvariant - Did you mean in the comment above?

Oh I was asking if you could add an example to the .EXAMPLE section of the comment-based help.

@selsine
Copy link
Author

selsine commented Mar 26, 2021

Ok Sorry this took me so long, I've added another example.

@jtarquino
Copy link
Member

jtarquino commented Mar 29, 2021

Please add a test covering this new functionality in https://github.com/microsoft/ReportingServicesTools/blob/master/Tests/CatalogItems/Write-RsFolderContent.Tests.ps1
This should help to ensure future changes don't break it
After that I'll merge it

@fermenreq
Copy link

What about to download report file extension ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants