FileSystemSecurity.AuditRuleFactory Method

Definition

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

C#
public override sealed System.Security.AccessControl.AuditRule AuditRuleFactory (System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags);

Parameters

identityReference
IdentityReference

An IdentityReference object that represents a user account.

accessMask
Int32

An integer that specifies an access type.

isInherited
Boolean

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

inheritanceFlags
InheritanceFlags

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

propagationFlags
PropagationFlags

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

flags
AuditFlags

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

Returns

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

Exceptions

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

The identityReference property is null.

-or-

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.

Remarks

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.

Applies to

Produkt Versjoner
.NET Core 1.0, Core 1.1, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5