Export (0) Print
Expand All

Application.ExistsOnDtsServer Method

Returns a Boolean that indicates whether the specified package already exists on the Integration Services service.

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

public bool ExistsOnDtsServer(
	string sPackagePath,
	string sServerName
)

Parameters

sPackagePath
Type: System.String
The fully qualified path of the package.
sServerName
Type: System.String
The name of the server to search for the package.

Return Value

Type: System.Boolean
true if the package specified by sPackagePath exists on the server named by sServerName; otherwise, false.

The following code example shows a package being saved to the File System under the parent folder, myFolder2. The example then checks if the package was saved by querying using the ExistsOnDtsServer method.

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();
            Package p = app.LoadPackage(pkg, null);
            
            // Save the package under myFolder which is found under the 
            // File System folder on the DTS Service
            app.SaveToDtsServer(p, null, @"File System\myFolder2", "yourserver");

            // Verify that the package was saved by 
            // using ExistsOnDtsServer.
            Boolean packageExists = app.ExistsOnDtsServer(@"File System\myFolder", "yourserver");
            Console.WriteLine("Package exists? " + packageExists);
        }

Sample Output:

Folder exists? True

Package exists? True

Folder exists? False

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

Community Additions

ADD
Show:
© 2014 Microsoft