FileSystemAclExtensions.SetAccessControl Method

Definition

Overloads

SetAccessControl(DirectoryInfo, DirectorySecurity)

Changes the security attributes of an existing directory.

SetAccessControl(FileInfo, FileSecurity)

Changes the security attributes of an existing file.

SetAccessControl(FileStream, FileSecurity)

Changes the security attributes of an existing file.

SetAccessControl(DirectoryInfo, DirectorySecurity)

Changes the security attributes of an existing directory.

public:
[System::Runtime::CompilerServices::Extension]
 static void SetAccessControl(System::IO::DirectoryInfo ^ directoryInfo, System::Security::AccessControl::DirectorySecurity ^ directorySecurity);
public static void SetAccessControl (this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity);
static member SetAccessControl : System.IO.DirectoryInfo * System.Security.AccessControl.DirectorySecurity -> unit
<Extension()>
Public Sub SetAccessControl (directoryInfo As DirectoryInfo, directorySecurity As DirectorySecurity)

Parameters

directoryInfo
DirectoryInfo

An existing directory.

directorySecurity
DirectorySecurity

The security information to apply to the directory.

Exceptions

directorySecurity is null.

SetAccessControl(FileInfo, FileSecurity)

Changes the security attributes of an existing file.

public:
[System::Runtime::CompilerServices::Extension]
 static void SetAccessControl(System::IO::FileInfo ^ fileInfo, System::Security::AccessControl::FileSecurity ^ fileSecurity);
public static void SetAccessControl (this System.IO.FileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity);
static member SetAccessControl : System.IO.FileInfo * System.Security.AccessControl.FileSecurity -> unit
<Extension()>
Public Sub SetAccessControl (fileInfo As FileInfo, fileSecurity As FileSecurity)

Parameters

fileInfo
FileInfo

An existing file.

fileSecurity
FileSecurity

The security information to apply to the file.

Exceptions

fileSecurity is null.

SetAccessControl(FileStream, FileSecurity)

Changes the security attributes of an existing file.

public:
[System::Runtime::CompilerServices::Extension]
 static void SetAccessControl(System::IO::FileStream ^ fileStream, System::Security::AccessControl::FileSecurity ^ fileSecurity);
public static void SetAccessControl (this System.IO.FileStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity);
static member SetAccessControl : System.IO.FileStream * System.Security.AccessControl.FileSecurity -> unit
<Extension()>
Public Sub SetAccessControl (fileStream As FileStream, fileSecurity As FileSecurity)

Parameters

fileStream
FileStream

An existing file.

fileSecurity
FileSecurity

The security information to apply to the file.

Exceptions

fileStream or fileSecurity is null.

The file stream is closed.

Applies to