Partager via


ProtectionLevel propriété

Gets or sets the level of protection on the package.

Espace de noms :  Microsoft.SqlServer.Dts.Runtime
Assembly :  Microsoft.SqlServer.ManagedDTS (dans Microsoft.SqlServer.ManagedDTS.dll)

Syntaxe

'Déclaration
Public Property ProtectionLevel As DTSProtectionLevel
    Get
    Set
'Utilisation
Dim instance As Package
Dim value As DTSProtectionLevel

value = instance.ProtectionLevel

instance.ProtectionLevel = value
public DTSProtectionLevel ProtectionLevel { get; set; }
public:
property DTSProtectionLevel ProtectionLevel {
    DTSProtectionLevel get ();
    void set (DTSProtectionLevel value);
}
member ProtectionLevel : DTSProtectionLevel with get, set
function get ProtectionLevel () : DTSProtectionLevel
function set ProtectionLevel (value : DTSProtectionLevel)

Valeur de la propriété

Type : Microsoft.SqlServer.Dts.Runtime. . :: . .DTSProtectionLevel
A value from the DTSProtectionLevel enumeration.

Notes

For more information on setting package protection levels, see Définition du niveau de protection des packages.

Exemples

The following example loads a package, and then retrieves several package properties, including the ProtectionLevel assigned to the package.

Class PackageTest
    {
        static void Main(string[] args)
        {
            // The variable pkg points to the location of the
            // ExecuteProcess package sample
            // installed with the 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);
    
            // Once the package is loaded, this sample can
           // query on several properties
            long cc = p.CertificateContext;
            string cfn = p.CheckpointFileName;
            DTSProtectionLevel pl = p.ProtectionLevel;
            DTSPackageType dpt = p.PackageType;

            Console.WriteLine("CertificateContext = " + cc);
            Console.WriteLine("CheckpointFileName = " + cfn);
            Console.WriteLine("ProtectionLevel = " + pl);
            Console.WriteLine("PackageType = " + dpt);
        }
    }
Class PackageTest
    {
        Shared  Sub Main(ByVal args() As String)
            ' The variable pkg points to the location of the
            ' ExecuteProcess package sample
            ' installed with the samples.
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx" 
 
            Dim app As Application =  New Application() 
            Dim p As Package =  app.LoadPackage(pkg,Nothing) 
 
            ' Once the package is loaded, this sample can
           ' query on several properties
            Dim cc As Long =  p.CertificateContext 
            Dim cfn As String =  p.CheckpointFileName 
            Dim pl As DTSProtectionLevel =  p.ProtectionLevel 
            Dim dpt As DTSPackageType =  p.PackageType 
 
            Console.WriteLine("CertificateContext = " + cc)
            Console.WriteLine("CheckpointFileName = " + cfn)
            Console.WriteLine("ProtectionLevel = " + pl)
            Console.WriteLine("PackageType = " + dpt)
        End Sub
    }

Sample Output:

CertificateContext = 0

CheckpointFileName =

ProtectionLevel = EncryptSensitiveWithUserKey

PackageType = Default