Language

ReportingService2005.ListChildren(String, Boolean) メソッド

定義

指定されたフォルダの子リストを取得します。

public:
 cli::array <ReportService2005::CatalogItem ^> ^ ListChildren(System::String ^ Item, bool Recursive);
public ReportService2005.CatalogItem[] ListChildren(string Item, bool Recursive);
member this.ListChildren : string * bool -> ReportService2005.CatalogItem[]
Public Function ListChildren (Item As String, Recursive As Boolean) As CatalogItem()

パラメーター

Item
String

親フォルダのフルパス名。

Recursive
Boolean

指定された項目の下にある子項目の木全体を返すかどうかを示す Boolean 式です。 既定値は false です。

返品

CatalogItem オブジェクトの配列。 子が存在しない場合、このメソッドは空の CatalogItem オブジェクトを返します。

例

以下のコード例をコンパイルするには、Reporting ServicesのWSDLを参照し、特定の名前空間をインポートする必要があります。 詳細については 、「コード例のコンパイルと実行」をご覧ください。 以下のコード例では、 ListChildren メソッドを用いてレポートサーバーのディレクトリツリーのルート内容を読み取り、最初のアイテムとそのプロパティをXMLドキュメントとして格納しています。

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 ReportingService2005()  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials  

      Dim items As CatalogItem() = Nothing  

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

      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml.ToString())  
      End Try  

      ' Serialize the contents as an XML document and write the contents to a file.  
      Try  
         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  
         Console.WriteLine(e.Message)  
      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()  
   {  
      ReportingService2005 rs = new ReportingService2005();  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;  

      CatalogItem[] items = null;  

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

      catch (SoapException e)  
      {  
         Console.WriteLine(e.Detail.OuterXml);  
      }  

      // Serialize the contents as an XML document and write the contents to a file.  
      try  
      {  
         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)  
      {  
         Console.WriteLine(e.Message);  
      }  
   }  
}  

注釈

以下の表は、この操作のヘッダーおよび権限情報を示しています。

SOAPヘッダー (アウト) ServerInfoHeaderValue
必要なアクセス許可 ReadProperties に Item

ListChildrenメソッドは、ユーザーが閲覧権限を持つ子項目のみを返します。 返されるアイテムは、指定された親アイテムの子アイテムの完全なリストを表すとは限りません。

ListChildrenメソッドがレポートサーバーデータベースのルート上でMy Reportsを有効にして呼び出されると、そのメソッドはMy Reportsフォルダのプロパティを含むCatalogItemオブジェクトの配列を返します。 ユーザーが匿名でMyReportsが有効の場合、ルート上で ListChildren が呼び出された際にMy Reportsのプロパティは返されません。

ListChildrenメソッドは、レポートサーバーデータベース内の仮想パスをサポートするアイテムのVirtualPathプロパティを返すことができます。 仮想パスとは、ユーザーがアイテムを見ることを期待する経路のことです。 例えば、ユーザーの個人の「My Reports」フォルダにある「Report1」というレポートは、仮想パスとして「/My Reports」と等しいです。 アイテムの実際の経路は /Users/Username/My Reports です。

このメソッドが返すプロパティの大半は読み取り専用です。 Reporting Servicesのアイテムプロパティの詳細については、「Report Server Item Properties」をご覧ください。

適用対象