DirectorySecurity DirectorySecurity DirectorySecurity DirectorySecurity Constructors

定義

多載

DirectorySecurity() DirectorySecurity() DirectorySecurity()

初始化 DirectorySecurity 類別的新執行個體。Initializes a new instance of the DirectorySecurity class.

DirectorySecurity(String, AccessControlSections) DirectorySecurity(String, AccessControlSections) DirectorySecurity(String, AccessControlSections) DirectorySecurity(String, AccessControlSections)

使用 DirectorySecurity 列舉型別 (Enumeration) 之指定的值,從指定的目錄初始化 AccessControlSections 類別的新執行個體。Initializes a new instance of the DirectorySecurity class from a specified directory using the specified values of the AccessControlSections enumeration.

DirectorySecurity() DirectorySecurity() DirectorySecurity()

初始化 DirectorySecurity 類別的新執行個體。Initializes a new instance of the DirectorySecurity class.

public:
 DirectorySecurity();
public DirectorySecurity ();
Public Sub New ()

例外狀況

目前的作業系統不是 Microsoft Windows 2000 (含) 以後版本。The current operating system is not Microsoft Windows 2000 or later.

備註

當您想要建立不是以現有目錄DirectorySecurity為基礎的空物件時, 請使用這個函式。Use this constructor when you want to create an empty DirectorySecurity object that is not based on an existing directory. 接著, 您可以使用存取控制資訊來填入物件, 並將其套用至目錄。You can then populate the object with access control information and apply it to a directory.

DirectorySecurity(String, AccessControlSections) DirectorySecurity(String, AccessControlSections) DirectorySecurity(String, AccessControlSections) DirectorySecurity(String, AccessControlSections)

使用 DirectorySecurity 列舉型別 (Enumeration) 之指定的值,從指定的目錄初始化 AccessControlSections 類別的新執行個體。Initializes a new instance of the DirectorySecurity class from a specified directory using the specified values of the AccessControlSections enumeration.

public:
 DirectorySecurity(System::String ^ name, System::Security::AccessControl::AccessControlSections includeSections);
public DirectorySecurity (string name, System.Security.AccessControl.AccessControlSections includeSections);
new System.Security.AccessControl.DirectorySecurity : string * System.Security.AccessControl.AccessControlSections -> System.Security.AccessControl.DirectorySecurity
Public Sub New (name As String, includeSections As AccessControlSections)

參數

name
String String String String

從其中建立 DirectorySecurity 物件之目錄的位置。The location of a directory to create a DirectorySecurity object from.

includeSections
AccessControlSections AccessControlSections AccessControlSections AccessControlSections

其中一個 AccessControlSections 值,指定要擷取之存取控制清單 (ACL) 資訊的類型。One of the AccessControlSections values that specifies the type of access control list (ACL) information to retrieve.

例外狀況

name 參數為零長度字串,只包含空格或包含一或多個由 InvalidPathChars 所定義的無效字元。The name parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.

指定的路徑無效 (例如,位於未對應的磁碟上)。The specified path is invalid, (for example, it is on an unmapped drive).

找不到 name 參數中指定的檔案。The file specified in the name parameter was not found.

開啟目錄時發生 I/O 錯誤。An I/O error occurred while opening the directory.

name 參數的格式無效。The name parameter is in an invalid format.

目前的作業系統不是 Microsoft Windows 2000 (含) 以後版本。The current operating system is not Microsoft Windows 2000 or later.

指定的路徑、檔案名稱,或兩者都超出系統定義的長度上限。The specified path, file name, or both exceed the system-defined maximum length.

目前的系統帳戶沒有系統管理權限。The current system account does not have administrative privileges.

找不到此目錄。The directory could not be found.

name 參數指定了唯讀的目錄。The name 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.

備註

此函式會抓取指定目錄的存取控制資訊, 然後建立DirectorySecurity封裝該資訊的物件。This constructor retrieves the access control information for the specified directory and then creates a DirectorySecurity object that encapsulates that information. 接著, 您可以檢查、新增或刪除指定目錄的存取控制資訊。You can then inspect, add, or delete the access control information for the specified directory.

安全性

FileIOPermission
用於存取name參數所指定之目錄的許可權。for permission to access the directory specified by the name parameter. 相關聯的NoAccess列舉:、ViewAssociated enumerations: NoAccess , View 安全性動作:需Security action: Demand

適用於