Description
Deletes the named batch job on the named server. The caller must own the job, or have operator privileges on the server.
Structure
DWORD BatchDeleteJob(LPCTSTR jobid, LPCTSTR reserved);
Parameters
LPCTSTR jobid |
Specifies the unique job-identification string. |
LPCTSTR reserved |
This parameter is reserved for future use, and is currently ignored. |
Return Values
BATCH_ERROR_JOB_IS_RUNNING |
The job is currently running. Use BatchAbortJob to cancel a running job. |
BATCH_ERROR_NO_SUCH_JOB |
The system could not find the named job. |
BATCH_ERROR_BAD_JOB_NAME |
The jobid was null or the syntax was incorrect. |
BATCH_ERROR_OWNER_OR_OPERATOR_ACCESS_DENIED |
The caller neither owns the job nor has operator privileges. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
LPCTSTR JobId=NULL;
LPCTSTR Reserved=NULL;
char * pJobId;
DWORD ReturnVal=0;
cout << "TESTING THE BATCHDELETEJOB API"<<endl;
pJobId = new char [ MAX_LENGTH ];
if (pJobId == NULL){
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
exit(0);
}
cout << "Enter the job-id of the job to delete";
cin >> pJobId;
JobId = (const char *)pJobId;
ReturnVal = BatchDeleteJob(JobId,Reserved);
switch (ReturnVal)
{
case BATCH_ERROR_NO_SUCH_JOB :
cout << " The Job does not exist : " << JobId <<endl;
break;
case BATCH_ERROR_JOB_IS_RUNNING :
cout << " The Job Is In Running Mode : " << JobId <<endl;
break;
case BATCH_ERROR_BAD_JOB_NAME :
cout << " The First argument syntax is wrong or it is NULL : " << JobId <<endl;
break;
case BATCH_ERROR_OWNER_OR_OPERATOR_ACCESS_DENIED :
cout << " The Job is Not Owned by the Current User : " << JobId << endl;
break;
default :
cout << "THE JOB HAS BEEN SUCCESSFULLY DELETED" <<endl;
break;
}
cout<<"FINISHED TESTING THE BATCHDELETEJOB API"<<endl;
delete [] pJobId;
}