Created
April 3, 2017 20:10
-
-
Save crshnbrn66/0bf9815bab4620c601d49f4a6ba29140 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$reportExportPath = 'C:\temp\reports' | |
$reportFiles = Get-ChildItem $reportExportPath -Filter *.xml | |
foreach($file in $reportFiles) | |
{ | |
$reportobject = Import-Clixml -path ($file.fullname) | |
#$extensionsettings = [SSRSProxy.ExtensionSettings]::new() | |
$extensionSettings = New-Object -typename 'SSRSProxy.ExtensionSettings' | |
$extensionSettings.Extension = $reportobject.Subscriptions.properties.extensionSettings.Extension | |
$paramvalues = @() | |
foreach($parameterField in $reportobject.Subscriptions.properties.extensionSettings.ParameterValues) | |
{ | |
if($parameterfield.psobject.Properties.name[0] -eq 'ParameterName') #rebuild the object into an extenstion setting this one contains a parameter field reference | |
{ | |
$a = [SSRSProxy.ParameterFieldReference]::new() | |
$a.FieldAlias = $reportobject.Subscriptions.properties.extensionSettings.ParameterValues.fieldalias | |
$a.ParameterName = $reportobject.Subscriptions.properties.extensionSettings.ParameterValues.ParameterName | |
} | |
elseif($parameterfield.psobject.Properties.name[0] -eq 'Name') #rebuild the object into an extension settings object this one contains a param value | |
{ | |
$a = [SSRSProxy.ParameterValue]::New() | |
$a.Label = $parameterField.Label | |
$a.Name = $parameterField.Name | |
$a.Value = $parameterField.Value | |
} | |
$paramvalues += $a | |
} | |
$extensionSettings.ParameterValues = [ssrsproxy.parametervalueorfieldreference[]]$paramvalues | |
#$extensionSettings.ParameterValues = $extParams | |
[SSRSProxy.DataRetrievalPlan]$DataRetrievalPlan = New-Object SSRSProxy.DataRetrievalPlan | |
[SSRSProxy.DataSourceReference]$item = $reportobject.Subscriptions.properties.DataRetrievalPlan.Item | |
$DataRetrievalPlan.DataSet = $reportobject.Subscriptions.properties.DataRetrievalPlan.DataSet | |
$description = $reportobject.Subscriptions.properties.Description | |
$eventtype = $reportobject.Subscriptions.properties.eventtype | |
$matchdata = $reportobject.Subscriptions.properties.matchdata | |
$b = [Ssrsproxy.parameterfieldreference]::new() | |
$b.FieldAlias = $reportobject.Subscriptions.properties.parameters.fieldalias | |
$b.ParameterName = $reportobject.Subscriptions.properties.parameters.ParameterName | |
[SSRSProxy.ParameterValueOrFieldReference]$ParameterValueOrFieldReference = $b | |
$itemPath = "$destination/$($reportObject.name)" | |
$ssrsproxy.CreateDataDrivenSubscription($itempath , $extensionsettings , $DataRetrievalPlan, $description, $eventtype, $matchdata, $ParameterValueOrFieldReference) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment