Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Applies access control list (ACL) entries described by a FileSecurity object to the file described by the current FileStream object.
public:
void SetAccessControl(System::Security::AccessControl::FileSecurity ^ fileSecurity);
public void SetAccessControl(System.Security.AccessControl.FileSecurity fileSecurity);
member this.SetAccessControl : System.Security.AccessControl.FileSecurity -> unit
Public Sub SetAccessControl (fileSecurity As FileSecurity)
An object that describes an ACL entry to apply to the current file.
The file is closed.
The fileSecurity
parameter is null
.
The file could not be found or modified.
The current process does not have access to open the file.
While the FileStream class and SetAccessControl can be used on an existing file, consider using the FileInfo.SetAccessControl method as it's easier to use.
The SetAccessControl method applies access control list (ACL) entries to a file that represents the noninherited ACL list.
Caution
The ACL specified for the fileSecurity
parameter replaces the existing ACL for the file. To add permissions for a new user, use the GetAccessControl method to obtain the existing ACL, modify it, and then use SetAccessControl to apply it back to the 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.
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in