Export (0) Print
Expand All

Application.FolderExistsOnDtsServer Method

Returns a Boolean that indicates whether the specified folder already exists on the file system.

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

public bool FolderExistsOnDtsServer(
	string sFolderName,
	string sServerName
)

Parameters

sFolderName
Type: System.String
The name of the folder you are looking for. For example, to see if a folder name myFolder exists under the File System folder, use the escaped string, @"\File System\myFolder".
sServerName
Type: System.String
The name of the server to search for the package.

Return Value

Type: System.Boolean
true if the folder specified exists on the server; false if the folder does not exist.

The following code example queries the File System to determine whether a folder that was created previously, named myFolder, exists.

class PackageTest
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            Package p = app.LoadPackage(pkg, null);

            String folderName = @"\File System\myFolder";
            String serverName = "yourserver";
            Boolean folderExists = app.FolderExistsOnDtsServer(folderName, serverName);
            Console.WriteLine("Folder exists? " + folderExists);
        }
    }

Sample Output:

Folder exists? True

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft