JohnMiguel
JohnMiguel

Reputation: 175

Create an ReportServer folder within another ReportServer folder

I'm trying to create two RS folder with PowerShell. the first folder is created successfully but not the second one. basically, i am creating a folder within a folder.

$ReportServerUri = "http://localhost/ReportServer/ReportService2010.asmx?wsdl"
$global:proxy = New-WebServiceProxy -Uri $ReportServerUri -UseDefaultCredential

$type = $Proxy.GetType().Namespace
$datatype = ($type + '.Property')

$property = New-Object ($datatype);
$property.Name = "NewFolder"
$property.Value = "NewFolder"

$numproperties = 1
$properties = New-Object ($datatype + '[]')$numproperties 
$properties[0] = $property;

$proxy.CreateFolder("Test", "/", $properties);
$proxy.CreateFolder("Test/Test2", "/", $properties);

Upvotes: 2

Views: 323

Answers (1)

Matt
Matt

Reputation: 46710

$proxy.CreateFolder("Test/Test2", "/", $properties);

If you look at TechNet for CreateFolder() you will see you are not populating the root folder parameter correctly. That is what the second parameter is for. Slash is probably an illegal character for a folder name.

$proxy.CreateFolder("Test2", "/Test", $properties);

Should work.

Upvotes: 3

Related Questions