ReportingService2005.CreateFolder(String, String, Property[]) Method

Definition

将文件夹添加到报表服务器数据库。Adds a folder to the report server database.

public:
 void CreateFolder(System::String ^ Folder, System::String ^ Parent, cli::array <ReportService2005::Property ^> ^ Properties);
public void CreateFolder (string Folder, string Parent, ReportService2005.Property[] Properties);
member this.CreateFolder : string * string * ReportService2005.Property[] -> unit
Public Sub CreateFolder (Folder As String, Parent As String, Properties As Property())

Parameters

Folder
String

新文件夹的名称。The name of the new folder.

Parent
String

要向其中添加新文件夹的父文件夹的完整路径名。The full path name of the parent folder to which to add the new folder.

Properties
Property[]

Property 对象的数组,它定义要为文件夹设置的属性名和属性值。An array of Property objects that defines the property names and values to set for the folder.

Examples

若要编译此代码示例,必须引用 Reporting Services WSDL 并导入某些命名空间。To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. 有关详细信息,请参阅 编译和运行代码示例For more information, see Compiling and Running Code Examples. 下面的代码示例使用 CreateFolder 方法在 Report Server 数据库中创建文件夹:The following code example uses the CreateFolder method to create a folder in the report server database:

Imports System  
Imports System.Web.Services.Protocols  

Class Sample  
   Public Shared Sub Main()  
      Dim rs As New ReportingService2005()  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials  

      ' Create a custom property for the folder.  
      Dim newProp As New [Property]()  
      newProp.Name = "Department"  
      newProp.Value = "Finance"  
      Dim props(0) As [Property]  
      props(0) = newProp  

      Dim folderName As String = "Budget"  

      Try  
         rs.CreateFolder(folderName, "/", props)  
         Console.WriteLine("Folder created: {0}", folderName)  

      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml)  
      End Try  
   End Sub 'Main  
End Class 'Sample  
using System;  
using System.Web.Services.Protocols;  

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

      // Create a custom property for the folder.  
      Property newProp = new Property();  
      newProp.Name = "Department";  
      newProp.Value = "Finance";  
      Property[] props = new Property[1];  
      props[0] = newProp;  

      string folderName = "Budget";  

      try  
      {  
         rs.CreateFolder(folderName, "/", props);  
         Console.WriteLine("Folder created: {0}", folderName);  
      }  

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

Remarks

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

SOAP 标头SOAP Headers (In) BatchHeaderValue(In) BatchHeaderValue

(Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue
所需的权限Required Permissions CreateFolder

新文件夹的完整路径名称的长度不能超过260个字符;否则,将引发带有错误代码的 SOAP 异常 rsItemPathLengthExceededThe length of the full path name for the new folder cannot exceed 260 characters; otherwise, a SOAP exception is thrown with the error code rsItemPathLengthExceeded.

文件夹名称的长度必须少于128个字符。Folder names must be less than 128 characters long. 名称不能为空,不能包含空字符串,也不能包含以下保留字符::?The names cannot be null, consist of empty strings, or contain the following reserved characters: : ? ;@ & = + $,\ * > < | 。; @ & = + $ , \ * > < | . ".". 您可以使用正斜杠 (/) 来分隔文件夹的完整路径名中的项,但不能在文件夹名称的末尾使用。You can use the forward slash character (/) to separate items in the full path name of the folder, but you cannot use it at the end of the folder name.

如果启用我的报表,则 rsItemAlreadyExists 如果尝试在 Report Server 数据库的根文件夹中创建名为 "我的报表" 的文件夹,则会引发带有错误代码的 SOAP 异常。If My Reports is enabled, a SOAP exception is thrown with the error code rsItemAlreadyExists if you attempt to create a folder named "My Reports" in the root folder of the report server database.

将文件夹添加到 Report Server 数据库会修改 ModifiedBy ModifiedDate 父文件夹的和属性。Adding a folder to the report server database modifies the ModifiedBy and ModifiedDate properties of the parent folder.

Applies to