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

Definition

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

public:
 ReportService2010::CatalogItem ^ CreateFolder(System::String ^ Folder, System::String ^ Parent, cli::array <ReportService2010::Property ^> ^ Properties);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateFolder", 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("TrustedUserHeaderValue")]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
public ReportService2010.CatalogItem CreateFolder (string Folder, string Parent, ReportService2010.Property[] Properties);
[<System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateFolder", 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("TrustedUserHeaderValue")>]
[<System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)>]
member this.CreateFolder : string * string * ReportService2010.Property[] -> ReportService2010.CatalogItem
Public Function CreateFolder (Folder As String, Parent As String, Properties As Property()) As CatalogItem

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[]

An array of Property objects that defines the property names and values to set for the folder.

Returns

The created folder.

Attributes

Examples

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:

Imports System  
Imports System.Web.Services.Protocols  

Class Sample  
   Public Shared Sub Main()  
      Dim rs As New ReportingService2010()  
      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 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";  

      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 Header Usage (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
Native Mode Required Permissions CreateFolder
SharePoint Mode Required Permissions <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems>

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.

Applies to