Application.RenameFolderOnDtsServer(String, String, String, String) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Renomme un dossier dans l'instance spécifiée de SQL Server.
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)
Paramètres
- sParent
- String
Nom du dossier parent.
- sOldName
- String
Nom du dossier existant.
- sNewName
- String
Nouveau nom du dossier.
- sServerName
- String
Nom du serveur où se trouve le dossier.
Exemples
L’exemple de code suivant crée un dossier dans la hiérarchie des services Integration Services, vérifie que le dossier a été créé, le renomme, vérifie que l’ancien nom est toujours reconnu comme un dossier, puis vérifie si le nouveau nom de dossier est trouvé.
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
Exemple de sortie :
Folder exists? True
Old, renamed folder exists? False
New folder exists? True