TaskSetAccessControl Method
Applies access control list (ACL) entries described by a
TaskSecurity object to the file described by the current
Task object.
Namespace: Microsoft.Win32.TaskSchedulerAssembly: Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.11.1
public void SetAccessControl(
TaskSecurity taskSecurity
)
Parameters
- taskSecurity TaskSecurity
-
A TaskSecurity object that describes an access control list (ACL) entry to apply to the current task.
Give read access to all authenticated users for a task.
// Assume variable 'task' is a valid Task instance
var taskSecurity = task.GetAccessControl();
taskSecurity.AddAccessRule(new TaskAccessRule("Authenticated Users", TaskRights.Read, System.Security.AccessControl.AccessControlType.Allow));
task.SetAccessControl(taskSecurity);