CreateFolder 方法
將資料夾加入至報表伺服器資料庫或 SharePoint 文件庫。
命名空間: ReportService2010
組件: ReportService2010 (在 ReportService2010.dll 中)
語法
'宣告
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateFolder", RequestNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", _
ResponseNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
Public Function CreateFolder ( _
Folder As String, _
Parent As String, _
Properties As Property() _
) As CatalogItem
'用途
Dim instance As ReportingService2010
Dim Folder As String
Dim Parent As String
Dim Properties As Property()
Dim returnValue As CatalogItem
returnValue = instance.CreateFolder(Folder, _
Parent, Properties)
[SoapHeaderAttribute("TrustedUserHeaderValue")]
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateFolder", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
public CatalogItem CreateFolder(
string Folder,
string Parent,
Property[] Properties
)
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateFolder", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
public:
CatalogItem^ CreateFolder(
String^ Folder,
String^ Parent,
array<Property^>^ Properties
)
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateFolder", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
member CreateFolder :
Folder:string *
Parent:string *
Properties:Property[] -> CatalogItem
public function CreateFolder(
Folder : String,
Parent : String,
Properties : Property[]
) : CatalogItem
參數
- Folder
型別:System. . :: . .String
新資料夾的名稱。
- Parent
型別:System. . :: . .String
要加入新資料夾之父資料夾的完整路徑名稱。
- Properties
型別:array<ReportService2010. . :: . .Property> [] () [] []
Property 物件的陣列,定義要為資料夾設定的屬性名稱和值。
備註
The table below shows header and permissions information on this operation.
SOAP Header Usage |
(Out) ServerInfoHeaderValue |
Native Mode Required Permissions |
|
SharePoint Mode Required Permissions |
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.
範例
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);
}
}
}