ReportingService2010.ListChildren(String, Boolean) ReportingService2010.ListChildren(String, Boolean) ReportingService2010.ListChildren(String, Boolean) Method

定义

获取指定文件夹的子级的列表。 Gets a list of children of a specified folder.

public:
 cli::array <ReportService2010::CatalogItem ^> ^ ListChildren(System::String ^ ItemPath, bool Recursive);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/ListChildren", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
[System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")]
public ReportService2010.CatalogItem[] ListChildren (string ItemPath, bool Recursive);
Public Function ListChildren (ItemPath As String, Recursive As Boolean) As CatalogItem()
参数
ItemPath
String String String

父文件夹的完整路径名。 The full path name of the parent folder.

Recursive
Boolean Boolean Boolean

一个Boolean表达式,该表达式指示是否返回指定项下的整个子项树。 A Boolean expression that indicates whether to return the entire tree of child items below the specified item. 默认值是 false The default value is false.

请注意此参数设置to true在 SharePoint 模式下可以显著降低您的应用程序的性能。

Note Setting this parameter to true in SharePoint mode can significantly reduce the performance of your application.

返回

一个数组CatalogItem对象。 An array of CatalogItem objects. 如果不存在任何子项,则此方法返回一个空数组。 If no children exist, this method returns an empty array.

示例

若要编译下面的代码示例,必须引用 Reporting Services WSDL 并导入特定命名空间。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. 下面的代码示例使用ListChildren方法来读取报表服务器的根内容目录树,然后将第一个项并将其属性存储为 XML 文档: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 ReportingService2010()  
      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()  
   {  
      ReportingService2010 rs = new ReportingService2010();  
      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);  
      }  
   }  
}  

注解

下表显示了有关此操作的标头和权限信息。The table below shows header and permissions information on this operation.

SOAP 标头使用情况SOAP Header Usage (In) TrustedUserHeaderValue(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue
纯模式所需的权限Native Mode Required Permissions ReadPropertiesItemReadProperties on Item
SharePoint 模式下所需的权限SharePoint Mode Required Permissions ViewListItems

此方法返回用户有权查看的子项目。This 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.

如果使用我的报表启用报表服务器数据库的根上调用此方法,该方法返回的数组CatalogItem包含我的报表的文件夹的属性的对象。If this 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 this method is called on the root.

此方法可返回VirtualPath的支持的虚拟路径的报表服务器数据库中的项的属性。This 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. 例如,名为"Report1"位于用户的个人我的报表文件夹中的报表具有等于"/My Reports"的虚拟路径。For example, a report called "Report1" located in the user's personal My Reports folder has a virtual path equal to "/My Reports". 该项的实际路径是 /Users/用户名 * /我的报表。The actual path of the item is /Users/Username*/My Reports.

此方法返回的属性的大多数都是只读的。The majority of the properties this method returns are read-only. 有关 Reporting Services 中的项属性的详细信息,请参阅报表服务器项属性For more information about item properties in Reporting Services, see Report Server Item Properties.

适用于