FileSystemSecurity.AddAuditRule Method (FileSystemAuditRule)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Adds the specified audit rule to the current file or directory.

Namespace:   System.Security.AccessControl
Assembly:  mscorlib (in mscorlib.dll)

member AddAuditRule : 
        rule:FileSystemAuditRule -> unit


Type: System.Security.AccessControl.FileSystemAuditRule

A FileSystemAuditRule object that represents an audit rule to add to a file or directory.

Exception Condition

The rule parameter is null.

The AddAuditRule method adds a new audit rule to the list of rules contained within a FileSystemSecurity object.

If an audit rule already exists for the specified rule, the AddAuditRule method will still add the rule.

The following code example uses the AddAuditRule method to add an audit rule to a file and uses the RemoveAuditRule method to remove the audit rule from the file. You must supply a valid user or group account to run this example.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top