CreateFolderOnSqlServer Method

Application.CreateFolderOnSqlServer Method (String, String, String, String, String)

 

Creates a folder on the specified instance of SQL Server.

Namespace:   Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public void CreateFolderOnSqlServer(
	string strParent,
	string strNewFolderName,
	string strServerName,
	string strServerUserName,
	string strServerPassword
)

Parameters

strParent
Type: System.String

The name of the parent folder. If you want to create a folder under the File System node, use the CreateFolderOnDtsServer method.

strNewFolderName
Type: System.String

The name of the folder to create.

strServerName
Type: System.String

The name of the instance of SQL Server.

strServerUserName
Type: System.String

The user name to use when authenticating on the server.

strServerPassword
Type: System.String

The password associated with the strServerUserName account.

To verify that the folder was created, use the following Transact-SQL query, which selects all packages stored in the File System folder.

select * from sysssispackagefolders

Or, connect to the Integration Services server, expand Stored Packages, and then expand MSDB. The new folder that has the name given in strNewFolderName will be listed.

The following code example shows how to create a new folder named myNewFolder. The folder is stored in the sysssispackagefolders table in the SQL Server msdb database.

class ApplicationTests
    {
        static void Main(string[] args)
        {
           // The variable pkg points to the location
            // of the ExecuteProcess package sample 
            // that is installed with the SSIS samples.
            string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";

            Application app = new Application();

            //Create a folder, myNewFolder, in the 
            // SQL Server msdb database.
            app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", null, null);
        }
    }
Return to top
Show:
© 2016 Microsoft