FileSystemSecurity::AddAuditRule Method (FileSystemAuditRule^)
Adds the specified audit rule to the current file or directory.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- rule
-
Type:
System.Security.AccessControl::FileSystemAuditRule^
A FileSystemAuditRule object that represents an audit rule to add to a file or directory.
| Exception | Condition |
|---|---|
| ArgumentNullException | 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.
Available since 2.0