Description
Deletes the named queue. The queue must be empty, and disabled before it can be deleted. The caller must have management privileges on the server.
Syntax
DWORD BatchDeleteQueue(LPCTSTR queuename);
Parameter
LPCTSTR queuename |
Specifies the name of the queue to delete. |
Return Values
BATCH_ERROR_NO_SUCH_QUEUE |
The queue does not exist. |
BATCH_ERROR_QUEUE_IS_ACTIVE |
The queue is still enabled. |
BATCH_ERROR_QUEUE_NOT_EMPTY |
There are still jobs in the queue. |
BATCH_ERROR_BAD_QUEUE_NAME |
The syntax of the queue name was not valid. |
BATCH_ERROR_MANAGER_ ACCESS_DENIED |
The user does not have manager privileges. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
LPCTSTR QueName=NULL;
DWORD ReturnVal=0;
char * pTempName;
cout << "STARTED THE EXECUTION OF BATCHDELETEQUEUE API " << endl;
pTempName = new char [MAX_LENGTH];
if(pTempName == NULL){
cout << " Unable to allocate the memory." << endl;
exit(0);
}
cout << " Enter the Queue Name to be Deleted ";
cin >> pTempName;
QueName = (const char *)pTempName;
ReturnVal = BatchDeleteQueue( QueName );
switch(ReturnVal)
{
case BATCH_ERROR_NO_SUCH_QUEUE :
cout << " The queue does not exist. " << endl;
break;
case BATCH_ERROR_QUEUE_IS_ACTIVE :
cout << " The queue is still enabled. " << endl;
break;
case BATCH_ERROR_QUEUE_NOT_EMPTY :
cout << " There are still jobs in the queue. " << endl;
break;
case BATCH_ERROR_BAD_QUEUE_NAME :
cout << " The syntax of the queue name was not valid. " << endl;
break;
case BATCH_ERROR_MANAGER_ACCESS_DENIED :
cout << " The user does not have manager privileges. " << endl;
break;
default:
cout << "SUCCESSFUL DELETION OF THE QUEUE "<< endl;
}
cout << "FINISHED THE EXECUTION OF BATCHDELETEQUEUE API " << endl;
delete [] pTempName;
}