Compartir a través de


Audit.FilePath Propiedad

Gets or sets the location of the folder where the audit file is stored when the audit type is a file.

Espacio de nombres:  Microsoft.SqlServer.Management.Smo
Ensamblado:  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Sintaxis

'Declaración
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property FilePath As String 
    Get 
    Set
'Uso
Dim instance As Audit 
Dim value As String 

value = instance.FilePath

instance.FilePath = value
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public string FilePath { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property String^ FilePath {
    String^ get ();
    void set (String^ value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member FilePath : string with get, set
function get FilePath () : String 
function set FilePath (value : String)

Valor de la propiedad

Tipo: System.String
A String value that specifies the path of the file in which the audit log information is recorded.

Comentarios

You can set the audit destination type using the AuditDestinationType property.

Ejemplos

The following code example shows how to get the path of the destination audit log file.

C#

using System;
using Microsoft.SqlServer.Management.Smo;

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create the audit
            Server dbServer = new Server("(local)");
            dbAudit.DestinationType = AuditDestinationType.File;
            dbAudit.FilePath = "C:\\AuditDirectory";
            Audit dbAudit = new Audit(dbServer, "Test Audit");
            dbAudit.Create();

            //Display the path of the audit log file on the console
            Console.Writeline("The path of the audit log file is: " +
                              dbAudit.FilePath);
        }
    }
}

Powershell

#Create the audit
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbAudit = New-Object Microsoft.SqlServer.Management.Smo.Audit($dbServer, "Test Audit")
$dbAudit.DestinationType = [Microsoft.SqlServer.Management.Smo.AuditDestinationType]'File'
$dbAudit.FilePath = "C:\AuditDirectory"
$dbAudit.Create()

#Display the path of the audit log file
Write-Host "The path of the audit log file is:" $dbAudit.FilePath

Vea también

Referencia

Audit Clase

Espacio de nombres Microsoft.SqlServer.Management.Smo