ListChildren 方法

获取指定文件夹的子级的列表。

命名空间:  ReportService2005
程序集:  ReportService2005(在 ReportService2005.dll 中)

语法

声明
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListChildren", RequestNamespace := "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices",  _
    ResponseNamespace := "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
Public Function ListChildren ( _
    Item As String, _
    Recursive As Boolean _
) As CatalogItem()
用法
Dim instance As ReportingService2005
Dim Item As String
Dim Recursive As Boolean
Dim returnValue As CatalogItem()

returnValue = instance.ListChildren(Item, _
    Recursive)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListChildren", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
public CatalogItem[] ListChildren(
    string Item,
    bool Recursive
)
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListChildren", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
public:
array<CatalogItem^>^ ListChildren(
    String^ Item, 
    bool Recursive
)
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListChildren", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
member ListChildren : 
        Item:string * 
        Recursive:bool -> CatalogItem[] 
public function ListChildren(
    Item : String, 
    Recursive : boolean
) : CatalogItem[]

参数

  • Recursive
    类型:System. . :: . .Boolean
    一个布尔表达式,该表达式指示是否返回指定项下的整个子项树。默认值为 false。

返回值

类型:array<ReportService2005. . :: . .CatalogItem> [] () [] []
一个 CatalogItem 对象的数组。如果不存在任何子项,则此方法返回一个空 CatalogItem 对象。

注释

The table below shows header and permissions information on this operation.

SOAP Headers

(Out) ServerInfoHeaderValue

Required Permissions

ReadProperties on 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" 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 报表服务器项属性.

示例

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 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);
      }
   }
}