Get a Report Handle Using SSRS2008 and PowerShell V3

In order to work with report items with SQL Server Reporting Services 2008, most of the time you need to get a handle to the report items.

Here is a sample code snippet that uses the ReportingService2010 web service and PowerShell V3 CTP.

cls

#replace this with your reportserver web service URI
$ReportServerUri  = "http://localhost/ReportServer/ReportService2010.asmx";

$proxy = New-WebServiceProxy -Uri $ReportServerUri -UseDefaultCredential ;

#we'll use the ListChildren method to navigate through all your SSRS items
#the $true parameter specifies recursive navigation
$catalogitemsarray = $proxy.ListChildren("/", $true);

$reportpath = "/Customers/Customer Contact Numbers";
$report = $null;

foreach ($catalogitem in $catalogitemsarray)
{
   if($catalogitem.Path -eq $reportpath )
      {
         $report = $catalogitem;
      }
}

#display properties
$report

Sample result is as follows:

ID                    : 15b3dd87-d0de-43a0-8692-030dcfdab945
Name                  : Customer Contact Numbers
Path                  : /Customers/Customer Contact Numbers
VirtualPath           : 
TypeName              : Report
Size                  : 23870
SizeSpecified         : True
Description           : 
Hidden                : False
HiddenSpecified       : False
CreationDate          : 5/13/2012 12:13:48 AM
CreationDateSpecified : True
ModifiedDate          : 5/13/2012 12:13:48 AM
ModifiedDateSpecified : True
CreatedBy             : KERRIGANAdministrator
ModifiedBy            : KERRIGANAdministrator
ItemMetadata          : {}

Advertisements

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s