FileSystemAclExtensions.SetAccessControl Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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. |
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
.
Applies to
.NET 9 og andre versioner
Produkt | Versions |
---|---|
.NET | Core 1.0, Core 1.1, 6, 7, 8, 9 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5 |
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
.
Applies to
.NET 9 og andre versioner
Produkt | Versions |
---|---|
.NET | Core 1.0, Core 1.1, 6, 7, 8, 9 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5 |
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
.NET 9 og andre versioner
Produkt | Versions |
---|---|
.NET | Core 1.0, Core 1.1, 6, 7, 8, 9 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5 |
.NET feedback
.NET er et åben kildekode projekt. Vælg et link for at give feedback: