Uredi

Deli z drugimi prek


Directory.GetAccessControl Method

Definition

Returns the Windows access control list (ACL) for a directory.

Overloads

GetAccessControl(String)

Gets a DirectorySecurity object that encapsulates the access control list (ACL) entries for a specified directory.

GetAccessControl(String, AccessControlSections)

Gets a DirectorySecurity object that encapsulates the specified type of access control list (ACL) entries for a specified directory.

GetAccessControl(String)

Gets a DirectorySecurity object that encapsulates the access control list (ACL) entries for a specified directory.

public:
 static System::Security::AccessControl::DirectorySecurity ^ GetAccessControl(System::String ^ path);
public static System.Security.AccessControl.DirectorySecurity GetAccessControl (string path);
static member GetAccessControl : string -> System.Security.AccessControl.DirectorySecurity
Public Shared Function GetAccessControl (path As String) As DirectorySecurity

Parameters

path
String

The path to a directory containing a DirectorySecurity object that describes the file's access control list (ACL) information.

Returns

An object that encapsulates the access control rules for the file described by the path parameter.

Exceptions

The path parameter is null.

An I/O error occurred while opening the directory.

A system-level error occurred, such as the directory could not be found. The specific exception may be a subclass of SystemException.

The path parameter specified a directory that is read-only.

-or-

This operation is not supported on the current platform.

-or-

The caller does not have the required permission.

Remarks

Use the GetAccessControl method to retrieve the access control list (ACL) entries for a directory.

An ACL describes individuals and groups who have, or don't have, rights to specific actions on the given file or directory. For more information, see How to: Add or Remove Access Control List Entries.

In NTFS environments, ReadAttributes and ReadExtendedAttributes are granted to the user if the user has ListDirectory rights on the parent folder. To deny ReadAttributes and ReadExtendedAttributes, deny ListDirectory on the parent directory.

Applies to

GetAccessControl(String, AccessControlSections)

Gets a DirectorySecurity object that encapsulates the specified type of access control list (ACL) entries for a specified directory.

public:
 static System::Security::AccessControl::DirectorySecurity ^ GetAccessControl(System::String ^ path, System::Security::AccessControl::AccessControlSections includeSections);
public static System.Security.AccessControl.DirectorySecurity GetAccessControl (string path, System.Security.AccessControl.AccessControlSections includeSections);
static member GetAccessControl : string * System.Security.AccessControl.AccessControlSections -> System.Security.AccessControl.DirectorySecurity
Public Shared Function GetAccessControl (path As String, includeSections As AccessControlSections) As DirectorySecurity

Parameters

path
String

The path to a directory containing a DirectorySecurity object that describes the file's access control list (ACL) information.

includeSections
AccessControlSections

One of the AccessControlSections values that specifies the type of access control list (ACL) information to receive.

Returns

An object that encapsulates the access control rules for the file described by the path parameter.

Exceptions

The path parameter is null.

An I/O error occurred while opening the directory.

A system-level error occurred, such as the directory could not be found. The specific exception may be a subclass of SystemException.

The path parameter specified a directory that is read-only.

-or-

This operation is not supported on the current platform.

-or-

The caller does not have the required permission.

Remarks

Use the GetAccessControl method to retrieve the access control list (ACL) entries for a directory.

An ACL describes individuals and groups who have, or don't have, rights to specific actions on the given file or directory. For more information, see How to: Add or Remove Access Control List Entries.

In NTFS environments, ReadAttributes and ReadExtendedAttributes are granted to the user if the user has ListDirectory rights on the parent folder. To deny ReadAttributes and ReadExtendedAttributes, deny ListDirectory on the parent directory.

Applies to