共用方式為


ReportingService2006.CreateFolder(String, String) Method

Definition

Adds a folder to a SharePoint library.

public:
 ReportService2006::CatalogItem ^ CreateFolder(System::String ^ Folder, System::String ^ Parent);
public ReportService2006.CatalogItem CreateFolder (string Folder, string Parent);
member this.CreateFolder : string * string -> ReportService2006.CatalogItem
Public Function CreateFolder (Folder As String, Parent As String) As CatalogItem

Parameters

Folder
String

The name of the new folder.

Parent
String

The fully qualified URL for the parent folder or site that will contain the new folder.

Returns

A CatalogItem object for the newly created folder.

Examples

using System;  
using System.Collections.Generic;  
using System.IO;  
using System.Text;  
using System.Web;  
using System.Web.Services;  
using System.Web.Services.Protocols;  

class Sample  
{  
    static void Main(string[] args)  
    {  
        ReportingService2006 rs = new ReportingService2006();  
        rs.Url = "http://<Server Name>" +  
            "/_vti_bin/ReportServer/ReportService2006.asmx";  
        rs.Credentials =   
            System.Net.CredentialCache.DefaultCredentials;  

        string folderName = "Budget";  
        string parent = "http://<Server Name>/Docs/Documents/";  

        try  
        {  
            rs.CreateFolder(folderName, parent);  
            Console.WriteLine("Folder created: {0}", folderName);  
        }  
        catch (SoapException e)  
        {  
            Console.WriteLine(e.Detail.InnerXml);  
        }  
    }  
}  
Imports System  
Imports System.Web.Services  
Imports System.Web.Services.Protocols  

Class Sample  

    Public Shared Sub Main()  

        Dim rs As New ReportingService2006()  
        rs.Url = "http://<Server Name>" + _  
            "/_vti_bin/ReportServer/ReportService2006.asmx"  
        rs.Credentials = _  
            System.Net.CredentialCache.DefaultCredentials  

        Dim folderName As String = "Budget"  
        Dim parentPath As String = _  
            "http://<Server Name>/Docs/Documents/"  

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

        Catch e As SoapException  
            Console.WriteLine(e.Detail.InnerXml)  
        End Try  

    End Sub  

End Class  

Remarks

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

SOAP Headers (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
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 rsItemPathLengthExceeded.

Folder names must be less than 128 characters long. The names cannot be null, consist of empty strings, or contain the following reserved characters: : ? @ & = + $ , \ * > < | . ".

Adding a folder to a SharePoint library modifies the ModifiedBy and ModifiedDate properties of the parent folder.

Applies to