ReportingService2010.CreateFolder(String, String, Property[]) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将文件夹添加到报表服务器数据库或 SharePoint 库。
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
参数
- Folder
- String
新文件夹的名称。
- Parent
- String
要向其中添加新文件夹的父文件夹的完整路径名。
返回
创建的文件夹。
- 属性
示例
若要编译此代码示例,必须引用Reporting Services WSDL 并导入某些命名空间。 有关详细信息,请参阅 编译和运行代码示例。 下面的代码示例使用 CreateFolder 方法在报表服务器数据库中创建文件夹:
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);
}
}
}
注解
下表显示了有关此操作的标头和权限信息。
SOAP 标头用法 | (In) TrustedUserHeaderValue (Out) ServerInfoHeaderValue |
本机模式所需权限 | CreateFolder |
SharePoint 模式所需权限 | <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> |
新文件夹的完整路径名称长度不能超过 260 个字符;否则,将引发 SOAP 异常, rsItemLengthExceeded
错误代码为 。
文件夹名称的长度必须少于 128 个字符。 名称不能为 null、由空字符串组成或包含以下保留字符:: ? ;@ & = + $ , \ * >< | 。 ". 可以使用 /) (正斜杠字符分隔文件夹的完整路径名称中的项目,但不能在文件夹名称的末尾使用它。
如果启用了“我的报表”,则尝试在报表服务器数据库的根文件夹中创建名为“我的报表”的文件夹时,将引发 SOAP 异常并显示错误代码 rsItemAlreadyExists
。
将文件夹添加到报表服务器数据库会 ModifiedBy 修改父文件夹的 和 ModifiedDate 属性。