ReportingService2010.CreateFolder 方法

Adds a folder to the report server database or SharePoint library.

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

[SoapDocumentMethodAttribute("", RequestNamespace = "", 
	ResponseNamespace = "", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
public CatalogItem CreateFolder(
	string Folder,
	string Parent,
	Property[] Properties


The name of the new folder.
The full path name of the parent folder to which to add the new folder.
An array of Property objects that defines the property names and values to set for the folder.

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

SOAP Header Usage

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

Native Mode Required Permissions


SharePoint Mode Required Permissions


The length of the full path name for the new folder cannot exceed 260 characters; otherwise, a SOAP exception is thrown with the error code rsItemLengthExceeded.

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.

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.

Adding a folder to the report server database modifies the ModifiedBy and ModifiedDate properties of the parent folder.

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. The following code example uses the CreateFolder method to create a folder in the report server database:

using System;
using System.Web.Services.Protocols;

class Sample
   public static void Main()
      ReportingService rs = new ReportingService2010();
      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";

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

      catch(SoapException e)