Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cd2f91e

Browse files
Renamed Get-RsCatalogItems to Get-RsFolderContent
Renamed Get-RsCatalogItems to Get-RsFolderContent since its functionality is more inline with Out-RsFolderContent & Write-RsFolderContent. Clarified the help. Added help example for the -Recurse parameter. Added ValueFromPipeline = $true & process {} to support pipelining.
1 parent 2654f0f commit cd2f91e

File tree

2 files changed

+89
-10
lines changed

2 files changed

+89
-10
lines changed

‎Functions/CatalogItems/Get-RsCatalogItems.ps1‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2016 Microsoft Corporation. All Rights Reserved.
22
# Licensed under the MIT License (MIT)
33

4-
function Get-RsCatalogItems
4+
function Get-RsFolderContent
55
{
66
<#
77
.SYNOPSIS
@@ -29,11 +29,19 @@ function Get-RsCatalogItems
2929
3030
3131
.EXAMPLE
32-
Get-RsCatalogItems -ReportServerUri 'http://localhost/reportserver_sql2012' -Path /
32+
Get-RsFolderContent -ReportServerUri 'http://localhost/reportserver_sql2012' -Path /
3333
3434
Description
3535
-----------
36-
List all items under the root folder
36+
List all items directly at the root of the SSRS instance
37+
38+
.EXAMPLE
39+
Get-RsFolderContent -ReportServerUri 'http://localhost/reportserver_sql2012' -Path / -Recurse
40+
41+
Description
42+
-----------
43+
List all items directly at the root of the SSRS instance and under every folder below the root
44+
3745
#>
3846

3947
[cmdletbinding()]
@@ -46,18 +54,22 @@ function Get-RsCatalogItems
4654

4755
$Proxy,
4856

49-
[Parameter(Mandatory=$True)]
57+
[Parameter(Mandatory=$True,ValueFromPipeline=$true,ValueFromPipelinebyPropertyname=$true)]
5058
[string]
5159
$Path,
5260

5361
[switch]
5462
$Recurse
5563
)
56-
57-
if(-not $Proxy)
64+
process
5865
{
59-
$Proxy = New-RSWebServiceProxy -ReportServerUri $ReportServerUri -Credentials $ReportServerCredentials
60-
}
6166

62-
$Proxy.ListChildren($Path, $Recurse)
63-
}
67+
if(-not $Proxy)
68+
{
69+
$Proxy = New-RSWebServiceProxy -ReportServerUri $ReportServerUri -Credentials $ReportServerCredentials
70+
}
71+
72+
$Proxy.ListChildren($Path, $Recurse)
73+
}
74+
}
75+
New-Alias -Name "Get-RsCatalogItems" -Value Get-RsFolderContent -Scope Global
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copyright (c) 2016 Microsoft Corporation. All Rights Reserved.
2+
# Licensed under the MIT License (MIT)
3+
4+
function Get-RsFolderContent
5+
{
6+
<#
7+
.SYNOPSIS
8+
List all catalog items under a given path.
9+
10+
.DESCRIPTION
11+
List all catalog items under a given path.
12+
13+
.PARAMETER ReportServerUri
14+
Specify the Report Server URL to your SQL Server Reporting Services Instance.
15+
Has to be provided if proxy is not provided.
16+
17+
.PARAMETER ReportServerCredentials
18+
Specify the credentials to use when connecting to your SQL Server Reporting Services Instance.
19+
20+
.PARAMETER Proxy
21+
Report server proxy to use.
22+
Has to be provided if ReportServerUri is not provided.
23+
24+
.PARAMETER Path
25+
Path to folder.
26+
27+
.PARAMETER Recurse
28+
Recursively list subfolders with content.
29+
30+
31+
.EXAMPLE
32+
Get-RsFolderContent -ReportServerUri 'http://localhost/reportserver_sql2012' -Path /
33+
34+
Description
35+
-----------
36+
List all items under the root folder
37+
#>
38+
39+
[cmdletbinding()]
40+
param(
41+
[string]
42+
$ReportServerUri = 'http://localhost/reportserver',
43+
44+
[System.Management.Automation.PSCredential]
45+
$ReportServerCredentials,
46+
47+
$Proxy,
48+
49+
[Parameter(Mandatory=$True,ValueFromPipeline = $true,ValueFromPipelinebyPropertyname = $true)]
50+
[string]
51+
$Path,
52+
53+
[switch]
54+
$Recurse
55+
)
56+
process
57+
{
58+
59+
if(-not $Proxy)
60+
{
61+
$Proxy = New-RSWebServiceProxy -ReportServerUri $ReportServerUri -Credentials $ReportServerCredentials
62+
}
63+
64+
$Proxy.ListChildren($Path, $Recurse)
65+
}
66+
}
67+
New-Alias -Name "Get-RsCatalogItems" -Value Get-RsFolderContent -Scope Global

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /