ReportingService2006.MoveItem(String, String) 方法

定义

移动和/或重命名某项。

public:
 void MoveItem(System::String ^ Item, System::String ^ Target);
public void MoveItem (string Item, string Target);
member this.MoveItem : string * string -> unit
Public Sub MoveItem (Item As String, Target As String)

参数

Item
String

项的完全限定 URL,其中包括文件名和扩展名。

Target
String

项的新完全限定 URL,其中包括文件名和扩展名。

示例

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 currentPath = "http://<Server Name>/Docs/Documents" +  
            "/Data Sources/Sales Order Detail.rdl";  
        string targetPath = "http://<Server Name>/Docs/Documents/" +  
            "AdventureWorks Sample Reports/Sales Order Detail.rdl";  

        try  
        {  
            rs.MoveItem(currentPath, targetPath);  
        }  

        catch (SoapException e)  
        {  
            Console.WriteLine(e.Detail.OuterXml);  
        }  
    }  
}  
Imports System  
Imports System.IO  
Imports System.Text  
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 currentPath As String = "http://<Server Name>/Docs/" + _  
            "Documents/AdventureWorks Sample Reports/Sales Order Detail.rdl"  
        Dim targetPath As String = "http://<Server Name>/Docs/" + _  
            "Documents/Data Sources/Sales Order Detail.rdl"  

        Try  
            rs.MoveItem(currentPath, targetPath)  

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

    End Sub  

End Class  

注解

下表显示了有关此操作的标头和权限信息。

SOAP 标头 (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
所需的权限 <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems>Item如果目标父文件夹不同,则 (中Target父文件夹上的 and <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems>)

如果某个项从其父级继承安全策略,则移动该项会导致它继承目标文件夹的安全策略。 如果项未从其父项继承安全策略,则移动该项不会导致其安全策略发生更改。

如果目标路径与给定项不在同一 SharePoint 网站中,则返回错误 rsInvalidDestination

在 SharePoint 库中移动或重命名项目会 ModifiedBy 修改项目的 和 ModifiedDate 属性以及项目的源和目标文件夹。

适用于