Click or drag to resize
Task Scheduler Managed Class Library

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.TaskScheduler
Assembly:  Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.10.1
Syntax
public void SetAccessControl(
	TaskSecurity taskSecurity
)
Request Example View Source

Parameters

taskSecurity
Type: Microsoft.Win32.TaskSchedulerTaskSecurity
A TaskSecurity object that describes an access control list (ACL) entry to apply to the current task.
Examples

Give read access to all authenticated users for a task.

C#
// 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);
See Also