Uredi

Deli z drugimi prek


File.GetAccessControl Method

Definition

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

Overloads

GetAccessControl(String)

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

GetAccessControl(String, AccessControlSections)

Gets a FileSecurity object that encapsulates the specified type of access control list (ACL) entries for a particular file.

GetAccessControl(String)

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

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

Parameters

path
String

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

Returns

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

Exceptions

An I/O error occurred while opening the file.

The path parameter is null.

The file could not be found.

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

-or-

This operation is not supported on the current platform.

-or-

The path parameter specified a directory.

-or-

The caller does not have the required permission.

Remarks

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

An ACL describes individuals and groups who have, or don't have, rights to specific actions on the given file. 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 FileSecurity object that encapsulates the specified type of access control list (ACL) entries for a particular file.

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

Parameters

path
String

The path to a file containing a FileSecurity 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

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

Exceptions

An I/O error occurred while opening the file.

The path parameter is null.

The file could not be found.

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

-or-

This operation is not supported on the current platform.

-or-

The path parameter specified a directory.

-or-

The caller does not have the required permission.

Remarks

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

An ACL describes individuals and groups who have, or don't have, rights to specific actions on the given file. 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