Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ListChildren Method
Collapse the table of content
Expand the table of content

ListChildren Method

SQL Server 2000

ReportingService.ListChildren Method

Gets a list of children of a specified folder.

Public ListChildren( _
   ByVal Item As String, _
   ByVal Recursive As Boolean _
) As [Namespace].CatalogItem()
   Member of [Namespace].ReportingService

public CatalogItem[] ListChildren(
   string Item,
   bool Recursive
   Member of [Namespace].ReportingService
The full path name of the parent folder.
A Boolean expression that indicates whether to return the entire tree of child items below the specified item. The default value is false.
Return Value

An array of CatalogItem[] objects. If no children exist, this method returns an empty CatalogItem object.


Operation Description
Read Properties Required to read meta data properties that are associated with an item.


The ListChildren method returns only child items that the user has permission to view. The items that are returned may not represent a complete list of child items of the specified parent item.

If the ListChildren method is called on the root of the report server database with My Reports enabled, the method returns an array of CatalogItem[] objects containing properties for the folder My Reports. If the user is anonymous and My Reports is enabled, the properties for My Reports are not returned when ListChildren is called on the root.

The ListChildren method can return the VirtualPath property of items in the report server database that support virtual paths. The virtual path is the path under which a user expects to see the item. For example, a report called report1, which is located in the user's personal My Reports folder, has a virtual path equal to /My Reports. The actual path of the item is /Users/Username/My Reports.

The majority of the properties this method returns are read-only. For more information about item properties in Reporting Services, see Report Server Item Properties.


To compile the following code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following code example uses the ListChildren method to read the contents of the root of the report server directory tree, and then stores the first item and its properties as an XML document:

Imports System
Imports System.IO
Imports System.Text
Imports System.Web.Services.Protocols
Imports System.Xml
Imports System.Xml.Serialization

Class Sample
   Public Shared Sub Main()
      Dim rs As New ReportingService()
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials
      Dim items As CatalogItem() = Nothing
      ' Retrieve a list of all items from the report server database. 
         items = rs.ListChildren("/", True)
      Catch e As SoapException
      End Try
      ' Serialize the contents as an XML document and write the contents to a file.
         Dim fs As New FileStream("CatalogItems.xml", FileMode.Create)
         Dim writer As New XmlTextWriter(fs, Encoding.Unicode)
         Dim serializer As New XmlSerializer(GetType(CatalogItem()))
         serializer.Serialize(writer, items)
         Console.WriteLine("Server contents successfully written to a file.")
      Catch e As Exception
      End Try
   End Sub 'Main
End Class 'Sample

using System;
using System.IO;
using System.Text;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Serialization;

class Sample
   public static void Main()
      ReportingService rs = new ReportingService();
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

      CatalogItem[] items = null;

      // Retrieve a list of all items from the report server database. 
         items = rs.ListChildren("/", true);

      catch (SoapException e)

      // Serialize the contents as an XML document and write the contents to a file.
         FileStream fs = new FileStream("CatalogItems.xml", FileMode.Create);
         XmlTextWriter writer = new XmlTextWriter(fs, Encoding.Unicode); 

         XmlSerializer serializer = new XmlSerializer(typeof(CatalogItem[]));
         serializer.Serialize(writer, items);

         Console.WriteLine("Server contents successfully written to a file.");

      catch (Exception e)
See Also

ReportingService Class

Reporting Services Web Service Library

© 2015 Microsoft