The
Microsoft.SqlServer.Management.Smo.Agent namespace contains classes that represent the SQL Server Agent.
The Microsoft.SqlServer.Management.Smo.Agent namespace represents the SQL Server Agent. After a connection to an instance of SQL Server has been established by using the Server object variable, you can use the objects in the Microsoft.SqlServer.Management.Smo.Agent namespace to manage the SQL Server Agent.
The Microsoft.SqlServer.Management.Smo.Agent namespace resides in the Microsoft.SqlServer.Smo.dll assembly file. Also, some of the enumeration classes are in the Microsoft.SqlServer.SqlEnum.dll and Microsoft.SqlServer.SmoEnum.dll assembly files. You will have to import all three files to access the classes in the Microsoft.SqlServer.Management.Smo.Agent namespace.
By using the Microsoft.SqlServer.Management.Smo.Agent namespace, you can do the following:
-
View and modify SQL Server Agent settings.
-
Set up and manage operators.
-
Set up and manage alerts based on system messages or performance conditions.
-
Set up and manage jobs with multiple steps and schedules.
-
Manage proxy accounts for the subsystems on which jobs run.
-
Manage jobs that run on multiple servers.

Classes

Enumerations
| Enumeration | Description |
|---|
| ActivationOrder | The ActivationOrder enumeration contains values that are used to specify when the trigger runs in relation to the insert, update, or delete operation. |
| AgentLogLevels | The AgentLogLevels enumeration contains values that are used to specify the type of errors or messages that are logged by SQL Server. This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. |
| AgentMailType | The AgentMailType enumeration contains values that are used to specify the source of mail. |
| AgentSubSystem | The AgentSubSystem enumeration contains values that are used to specify the Microsoft SQL Server subsystems that can be used by job steps. |
| AlertType | The AlertType enumeration contains values that are used to specify the type of event or performance condition that causes alerts to be raised. |
| CategoryType | The CategoryType enumeration is a list of constant values that specify the type of category, such as whether the category refers to local jobs or multiserver administration. |
| CompletionAction | The CompletionAction enumeration is a list of constant values that specify the circumstances when a job completes after which another action is executed. |
| CompletionResult | The CompletionResult enumeration is a list of constant values that specify the status on completion of a job or job step. |
| FindOperand | The FindOperand enumeration represents a list of operands that are used to evaluate the DateJobCreated and DateJobLastModified properties to specify a range of dates in a job filter. |
| FrequencyRelativeIntervals | The FrequencyRelativeIntervals enumeration contains values that are used to specify the ordinal position of a recurring occurrence within a specified period. |
| FrequencySubDayTypes | The FrequencySubDayTypes enumeration contains values that are used to specify the way in which scheduling is managed within the period of a day. |
| FrequencyTypes | The FrequencyTypes enumeration contains values that are used to specify how often a schedule is executed. |
| JobExecutionStatus | The JobExecutionStatus enumeration is a list of constant values that specify the execution status of a job or job step. |
| JobOutcome | The JobOutcome enumeration is a list of constant values that specify the outcome after running a job. |
| JobServerType | The JobServerType enumeration is a list of constant values that specify the type of server with regard to multiserver or stand-alone administration. |
| JobStepFlags | The JobStepFlags enumeration is a list of constant values that specify the file to which to append job history information. |
| JobType | The JobType enumeration is a list of constant values that specify the location where the job is run (locally or on multiple servers). |
| MonthlyRelativeWeekDays | The MonthlyRelativeWeekDays enumeration contains values that specify the days of the week, weekdays, or every day. |
| NotifyMethods | The NotifyMethods enumeration contains values that specify the method used to notify operators in an alert or a job. This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. |
| NotifyType | The NotifyType enumeration contains values that are used to specify the notification type that restricts the output of the Alert object's EnumNotifications method. |
| OSRunPriority | The OSRunPriority enumeration contains constant values that specify the levels of priority given to running the operating system. |
| StepCompletionAction | The StepCompletionAction enumeration contains values that specify the action taken on completion of a job step. |
| TargetServerStatus | The TargetServerStatus enumeration contains values that specify the status of a target server. This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. |
| WeekDays | The WeekDays enumeration contains constant values that specify the days of the week. |