FileSystemSecurity.AccessRuleFactory Method
Initializes a new instance of the FileSystemAccessRule class that represents a new access control rule for the specified user, with the specified access rights, access control, and flags.
Assembly: mscorlib (in mscorlib.dll)
public override sealed AccessRule AccessRuleFactory( IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type )
Parameters
- identityReference
- Type: System.Security.Principal.IdentityReference
An IdentityReference object that represents a user account.
- accessMask
- Type: System.Int32
An integer that specifies an access type.
- isInherited
- Type: System.Boolean
true if the access rule is inherited; otherwise, false.
- inheritanceFlags
- Type: System.Security.AccessControl.InheritanceFlags
One of the InheritanceFlags values that specifies how to propagate access masks to child objects.
- propagationFlags
- Type: System.Security.AccessControl.PropagationFlags
One of the PropagationFlags values that specifies how to propagate Access Control Entries (ACEs) to child objects.
- type
- Type: System.Security.AccessControl.AccessControlType
One of the AccessControlType values that specifies whether access is allowed or denied.
Return Value
Type: System.Security.AccessControl.AccessRuleA new FileSystemAccessRule object that represents a new access control rule for the specified user, with the specified access rights, access control, and flags.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException |
The accessMask, inheritanceFlags, propagationFlags, or type parameters specify an invalid value. |
| ArgumentNullException |
The identityReference parameter is null. -or- The accessMask parameter is zero. |
| ArgumentException |
The identityReference parameter is neither of type SecurityIdentifier, nor of a type such as NTAccount that can be converted to type SecurityIdentifier. |
The recommended way to create access control rules is to use the constructors of the FileSystemAccessRule class.
The return type of the AccessRuleFactory method is the base class, AccessRule, but the return value can be cast safely to the derived class.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.