FileSystemSecurity.AuditRuleFactory Method (IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AuditFlags)


Initializes a new instance of the FileSystemAuditRule class representing the specified audit rule for the specified user.

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

public override sealed AuditRule AuditRuleFactory(
	IdentityReference identityReference,
	int accessMask,
	bool isInherited,
	InheritanceFlags inheritanceFlags,
	PropagationFlags propagationFlags,
	AuditFlags flags


Type: System.Security.Principal.IdentityReference

An IdentityReference object that represents a user account.

Type: System.Int32

An integer that specifies an access type.

Type: System.Boolean

true if the access rule is inherited; otherwise, false.

Type: System.Security.AccessControl.InheritanceFlags

One of the InheritanceFlags values that specifies how to propagate access masks to child objects.

Type: System.Security.AccessControl.PropagationFlags

One of the PropagationFlags values that specifies how to propagate Access Control Entries (ACEs) to child objects.

Type: System.Security.AccessControl.AuditFlags

One of the AuditFlags values that specifies the type of auditing to perform.

Return Value

Type: System.Security.AccessControl.AuditRule

A new FileSystemAuditRule object representing the specified audit rule for the specified user.

Exception Condition

The accessMask, inheritanceFlags, propagationFlags, or flags properties specify an invalid value.


The identityReference property is null.


The accessMask property is zero.


The identityReference property is neither of type SecurityIdentifier, nor of a type such as NTAccount that can be converted to type SecurityIdentifier.

The recommended way to create audit rules is to use the constructors of the FileSystemAuditRule class.

The return type of the AuditRuleFactory method is the base class, AuditRule, but the return value can be cast safely to the derived class.

.NET Framework
Available since 2.0
Return to top