FileSystemSecurity::RemoveAuditRule Method (FileSystemAuditRule^)

 

Removes all matching allow or deny audit rules from the current file or directory.

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

public:
bool RemoveAuditRule(
	FileSystemAuditRule^ rule
)

Parameters

rule
Type: System.Security.AccessControl::FileSystemAuditRule^

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

Return Value

Type: System::Boolean

true if the audit rule was removed; otherwise, false

Exception Condition
ArgumentNullException

The rule parameter is null.

The RemoveAuditRule method removes either all matching Deny audit rules or all matching Allow audit rules from the current FileSystemSecurity object. For example, you can use this method to remove all Deny audit rules for a user by passing a FileSystemAuditRule object created using the Deny value, the Failure value, and a user account. When you do this, the RemoveAuditRule method removes any deny rules that specify the Failure value or the Success value.

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
Show: