The RemoveJobByID method drops the SQLServerAgent job identified and removes the referencing Job object from the Jobs collection.
object.RemoveJobByID( JobID )
object
Expression that evaluates to an object in the Applies To list.
JobID
String representation of the system-generated, globally unique identifier for a job.
HRESULT RemoveJobByID(
SQLDMO_LPCSTR NewVal);
For SQLServerAgent, a job identifier is a 32-byte string representing a hexadecimal number.
The RemoveJobByID method completely removes a job. When a multiserver administration job is targeted on the master server (MSX), the MSX posts job-delete instructions to each execution target server (TSX). The indicated job is deleted at the MSX immediately. Each TSX deletes its local copy of the job when it next successfully polls the MSX and retrieves the delete instruction.
Note Removing a SQL Server Agent job by using the RemoveJobByID method requires appropriate permission. The Microsoft® SQL Server™ 2000 login used for SQLServer object connection must be the owner of the job indicated by the JobID argument or a member of a role with greater privilege.