Added function to create folder if target does not contain folder.
Added helper function to use relative path for linking data source which is helpful in scenarios where data source does not live in the same directory as report file.
CSS had a support ticket in which the customer had a password field provided by the data-driven subscription dataset query. The current GitHub script fails because it is trying to add a second instance of the PASSWORD parameter. The failure is:
Migrating data-driven subscription Monthly run of DATA0006116 (DataPortal) ... FAILURE:
System.Web.Services.Protocols.SoapException: An internal error occurred on the report server. See the error log for more details. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'PASSWORD' Key being added: 'PASSWORD'
at Microsoft.ReportingServices.Library.ReportingService2005Impl.CreateSubscription(String Report, ExtensionSettings ExtensionSettings
The updated code will check if the PASSWORD parameter already exists. If it does, then it will not add the PASSWORD parameter. The customer tested the updated script code and it successfully migrated all of his RS content to the new RS server.