Application.RenameFolderOnDtsServer(String, String, String, String) Methode

Definition

Benennt einen Ordner für die angegebene SQL Server-Instanz um.

public:
 void RenameFolderOnDtsServer(System::String ^ sParent, System::String ^ sOldName, System::String ^ sNewName, System::String ^ sServerName);
public void RenameFolderOnDtsServer (string sParent, string sOldName, string sNewName, string sServerName);
member this.RenameFolderOnDtsServer : string * string * string * string -> unit
Public Sub RenameFolderOnDtsServer (sParent As String, sOldName As String, sNewName As String, sServerName As String)

Parameter

sParent
String

Der Name des übergeordneten Ordners.

sOldName
String

Der Name des vorhandenen Ordners.

sNewName
String

Der neue Name des Ordners.

sServerName
String

Der Name des Servers, auf dem sich der Ordner befindet.

Beispiele

Im folgenden Codebeispiel wird ein Ordner in der Hierarchie der Integrationsdienste erstellt, überprüft, ob der Ordner erstellt wurde, ihn umbenennen, überprüft, ob der alte Name weiterhin als Ordner erkannt wird, und überprüft dann, ob der neue Ordnername gefunden wird.

static void Main(string[] args)  
        {  
            // Create a folder named myOldFolder.  
            Application app = new Application();  
            app.CreateFolderOnDtsServer(@"\File System\", "myOldFolder", "yourserver");  

            // Verify that creation was successful.  
            Boolean folderExists = app.FolderExistsOnDtsServer(@"File System\myOldFolder", "yourserver");  
            Console.WriteLine("Folder exists? " + folderExists);  

            // Rename myOldFolder to myNewFolder.  
            app.RenameFolderOnDtsServer(@"File System", "myOldFolder", "myNewFolder", "yourserver");  

            // Verify that the old folder still exists.  
            folderExists = app.FolderExistsOnDtsServer(@"File System\myOldFolder", "yourserver");  
            Console.WriteLine("Old, renamed folder exists? " + folderExists);  

            // Verify that the folder exists with the new name.   
            folderExists = app.FolderExistsOnDtsServer(@"File System\myNewFolder", "yourserver");  
            Console.WriteLine("New folder exists? " + folderExists);  
        }  
Shared  Sub Main(ByVal args() As String)  
    ' Create a folder named myOldFolder.  
    Dim app As Application =  New Application()   
    app.CreateFolderOnDtsServer("\File System\", "myOldFolder", "yourserver")  

    ' Verify that creation was successful.  
    Dim folderExists As Boolean =  app.FolderExistsOnDtsServer("File System\myOldFolder","yourserver")   
    Console.WriteLine("Folder exists? " + folderExists)  

    ' Rename myOldFolder to myNewFolder.  
    app.RenameFolderOnDtsServer("File System", "myOldFolder", "myNewFolder", "yourserver")  

    ' Check if the old folder still exists.  
    folderExists = app.FolderExistsOnDtsServer("File System\myOldFolder", "yourserver")  
    Console.WriteLine("Old, renamed folder exists? " + folderExists)  

    ' Verify that the folder exists with the new name.   
    folderExists = app.FolderExistsOnDtsServer("File System\myNewFolder", "yourserver")  
    Console.WriteLine("New folder exists? " + folderExists)  
End Sub  

Beispielausgabe:

Folder exists? True

Old, renamed folder exists? False

New folder exists? True

Gilt für: