Platform SDK: Active Directory, ADSI, and Directory Services

IADsPrintJob Property Methods

Property methods for the IADsPrintJob interface get or set the properties described in the following table. For more information, see Interface Property Methods.

Properties in Vtable Order

Property Description
Description

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Description
([out] BSTR *pbstrDescription);


HRESULT put_Description
([in] BSTR bstrDescription);

The description of the print job.
HostPrintQueue

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_HostPrintQueue
(
[out] BSTR *pbstrHostPrintQueue);

The ADsPath string of the Print Queue that is processing the print job.
Notify

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Notify
([out] BSTR *pbstrNotify);


HRESULT put_Notify
([in] BSTR bstrNotify);

The user to be notified when job is completed.
NotifyPath

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_NotifyPath
([out] BSTR *pbstrNotifyPath);


HRESULT put_NotifyPath
([in] BSTR bstrNotifyPath);

The ADsPath string of the user object to be notified when the print job is completed.
Priority

[Visual Basic]
Access: Read/Write
Data Type: LONG

[C++]
HRESULT get_Priority
([out] LONG *plPriority);


HRESULT put_Priority
([in] LONG lPriority);

The priority of the print job.
Size

[Visual Basic]
Access: Read
Data Type: LONG

[C++]
HRESULT get_Size
([out] LONG *plSize);

The size of the print job in bytes.
StartTime

[Visual Basic]
Access: Read/Write
Data Type: DATE

[C++]
HRESULT get_StartTime
([out] DATE *pdateStartTime);


HRESULT put_StartTime
([in] DATE dateStartTime);

The earliest time when the print job should be started.
TimeSubmitted

[Visual Basic]
Access: Read
Data Type: DATE

[C++]
HRESULT get_TimeSubmitted
([out] DATE *pdateTimeSubmitted);

The time when the job was submitted to the queue.
TotalPages

[Visual Basic]
Access: Read
Data Type: LONG

[C++]
HRESULT get_TotalPages
([out] LONG *plTotalPages);

The total number of pages in the print job.
UntilTime

[Visual Basic]
Access: Read/Write
Data Type: DATE

[C++]
HRESULT get_UntilTime
([out] DATE *pdateUntilTime);


HRESULT put_UntilTime
([in] DATE dateUntilTime);

The latest time when the print job should be started.
User

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_User
([out] BSTR *pbstrUser);

The name of user who submitted the print job.
UserPath

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_UserPath
([out] BSTR *pbstrUserPath);

The ADsPath string of the user object that submitted this print job.

Example Code [Visual Basic]

The following Visual Basic code example shows how to work with properties of a print job object.

Dim pqo as IADsPrintQueueOperations
Dim pj as IADsPrintJob
Set pqo = GetObject("WinNT://aMachine/aPrinter")
For Each pj in pqo.PrintJobs
    MsgBox "Host Printer: " & pj.HostPrintQueue
    MsgBox "Job description: " & pj.Description
    MsgBox "job requester: " & pj.User 
Next 

Example Code [C++]

The following C++ code snippet shows how to work with properties of a print job object.

IADsPrintQueueOperations *pqo;
IADsPrintJob *pJob;
HRESULT hr ;
LPWSTR adsPath =L"WinNT://aMachine/aPrinter";
hr = ADsGetObject(adsPath, 
                  IID_IADsPrintQueueOperations, 
                  (void**)&pqo);
if (FAILED(hr)) exit(hr);

IADsCollection *pColl;
hr = pqo->PrintJobs(&pColl);

// now to enumerate the print jobs. Code omitted.

IUnknown *pUnk = NULL;
hr = pColl->get__NewEnum(&pUnk);
pColl->Release();
if (FAILED(hr) ) exit(hr);

IEnumVARIANT *pEnum;
hr = pUnk->QueryInterface(IID_IEnumVARIANT,(void**)&pEnum);
pUnk->Release();
if (FAILED(hr)) exit(hr);

// Now Enumerate
BSTR bstr;
VARIANT var;
ULONG lFetch;
IDispatch *pDisp;

VariantInit(&var);
hr = pEnum->Next(1, &var, &lFetch);
while(hr == S_OK)
{
    if (lFetch == 1)    
    {
        pDisp = V_DISPATCH(&var);
        pDisp->QueryInterface(IID_IADsPrintJob, (void**)&pJob);

        pJob->get_HostPrintQueue(&bstr);
        printf("HostPrintQueue: %S\n",bstr);
        SysFreeString(bstr);

        pJob->get_Description(&bstr);
        printf("Print job name: %S\n",bstr);
        SysFreeString(bstr);

        pJob->get_User(&bstr);
        printf("Requester: %S\n",bstr);
        SysFreeString(bstr);

        pJob->Release();
    }
    VariantClear(&var);
    pDisp=NULL;
    hr = pEnum->Next(1, &var, &lFetch);
};

hr = pEnum->Release();

hr = pqo->Release();

See Also

IADsPrintJob, Interface Property Methods