Directory Services

IADsPrintQueueOperations::PrintJobs

The IADsPrintQueueOperations::PrintJobs method gets an IADsCollection interface pointer on the collection of the print jobs processed in this print queue. This collection can be enumerated using the standard Automation enumeration methods on IEnumVARIANT. To delete a print job, use the IADsCollection::Remove method on the retrieved interface pointer.

HRESULT PrintJobs( 
  IADsCollection** ppPrintJobs
);

Parameters

ppPrintJobs
[out] Pointer to a pointer to the IADsCollection interface on the collection of objects added to this print queue. Objects in the collection implement the IADsPrintJob interface.

Return Values

This method supports the standard return values. For more information about other return values, see the ADSI Error Codes.

Example Code [Visual Basic]

The following code example retrieves the collection object holding all the print jobs and then walk through each print job in the print queue.

Dim pqo As IADsPrintQueueOperations
Dim pjs As IADsCollection
On Error GoTo Cleanup
 
Set pqo = GetObject("WinNT://aMachine/aPrinter")
Set pjs = pqo.PrintJobs
For Each pj In pjs
	MsgBox pj.TotalPages
Next

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If
	Set pqo = Nothing
	Set pjs = Nothing

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

ADsEnumerateNext, IADsCollection, IADsCollection::Remove, IADsPrintJob, IADsPrintJob Property Methods, IADsPrintQueueOperations, IEnumVARIANT