![]() | TaskEventLog Class |
Namespace: Microsoft.Win32.TaskScheduler
The TaskEventLog type exposes the following members.
Name | Description | |
---|---|---|
![]() | TaskEventLog(String) |
Initializes a new instance of the TaskEventLog class.
|
![]() | TaskEventLog(String, String, String, String, String) |
Initializes a new instance of the TaskEventLog class.
|
![]() | TaskEventLog(DateTime, String, String, String, String, String) |
Initializes a new instance of the TaskEventLog class that looks at all task events from a specified time.
|
![]() | TaskEventLog(String, Int32, NullableDateTime, String, String, String, String) |
Initializes a new instance of the TaskEventLog class.
|
![]() | TaskEventLog(String, Int32, Int32, NullableDateTime, String, String, String, String) |
Initializes a new instance of the TaskEventLog class.
|
Name | Description | |
---|---|---|
![]() | Count |
Gets the total number of events for this task.
|
![]() | Enabled |
Gets or sets a value indicating whether this TaskEventLog is enabled.
|
![]() | EnumerateInReverse |
Gets or sets a value indicating whether to enumerate in reverse when calling the default enumerator (typically with foreach statement).
|
Name | Description | |
---|---|---|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetEnumerator |
Returns an enumerator that iterates through the collection.
|
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
// Create a log instance for the Maint task in the root directory TaskEventLog log = new TaskEventLog(@"\Maint", // Specify the event id(s) you want to enumerate new int[] { 141 /* TaskDeleted */, 201 /* ActionSuccess */ }, // Specify the start date of the events to enumerate. Here, we look at the last week. DateTime.Now.AddDays(-7)); // Tell the enumerator to expose events 'newest first' log.EnumerateInReverse = false; // Enumerate the events foreach (TaskEvent ev in log) { // TaskEvents can interpret event ids into a well known, readable, enumerated type if (ev.StandardEventId == StandardTaskEventId.TaskDeleted) output.WriteLine($" Task '{ev.TaskPath}' was deleted"); // TaskEvent exposes a number of properties regarding the event else if (ev.EventId == 201) output.WriteLine($" Completed action '{ev.DataValues["ActionName"]}', ({ev.DataValues["ResultCode"]}) at {ev.TimeCreated.Value}."); }