Reputation: 166
I can successfully create a linked report on my SSRS server using the powershell script here.
[string]$webServiceUrl = "http://myssrsserver/ReportServer/ReportService2010.asmx"
$ssrsProxy = New-WebServiceProxy -Uri $webServiceUrl -UseDefaultCredential
#File name of new linked item
$itemPath = "Linked server test"
#Path of where the linked report should be created in
$parent = "/A folder"
#Report we are basing our linked report on
$link = "/Reports/A report"
#Create property object
$type = $ssrsProxy.GetType().Namespace
$linkPropertyType = ($type + '.Property')
$linkProperty = New-Object ($linkPropertyType)
$linkProperty.Name = "Linked report description"
$linkProperty.Value = "Linked server test"
$ssrsProxy.CreateLinkedItem($itemPath,$parent,$link,$linkProperty)
I can't work out how to set the parameter on the linked report. It's a single value parameter, and I want it to be hidden, use default checked, and set to the value I pass. The parameter has a list of allowed values, but I know what I want to set is allowed.
Upvotes: 1
Views: 369
Reputation: 86
Just add the following to your code
# Create the linked item
$ssrsProxy.CreateLinkedItem($itemPath, $parent, $link, $linkProperty)
# Create an ItemParameter object for the internal parameter
$itemParameterType = ($type + '.ItemParameter')
$internalParam = New-Object ($itemParameterType)
$internalParam.Name = "UPDATE" # Replace with the actual parameter name
$internalParam.DefaultValues = @("UPDATE") # Replace with the desired value for
the parameter
# Add the ItemParameter object to an array
$itemParameters = @($internalParam)
# Set the parameter values for the linked item
$ssrsProxy.SetItemParameters("$parent/$itemPath", $itemParameters)
Upvotes: 0