ReportingService2005.ListChildren(String, Boolean) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取指定文件夹的子级的列表。
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 标头 | (Out) ServerInfoHeaderValue |
所需的权限 | Item 上的 ReadProperties |
方法 ListChildren 仅返回用户有权查看的子项。 返回的项不能表示指定父项的子项的完整列表。
ListChildren如果在启用了“我的报表”的情况下在报表服务器数据库的根目录上调用该方法,则该方法将返回包含文件夹“我的报表”属性的对象数组CatalogItem。 如果用户是匿名的并且启用了“我的报表”,则当在根上调用 时 ListChildren ,不会返回“我的报表”的属性。
方法 ListChildren 可以返回 VirtualPath 报表服务器数据库中支持虚拟路径的项的 属性。 虚拟路径是用户希望在其中查看项的路径。 例如,位于用户个人“我的报表”文件夹中名为“Report1”的报表具有等于“/我的报表”的虚拟路径。 项的实际路径为 /Users/Username/My Reports。
此方法返回的大多数属性都是只读的。 有关 Reporting Services 中的项属性的详细信息,请参阅报表服务器项属性。