This documentation is archived and is not being maintained.

PrintQueue.GetPrintJobInfoCollection Method

Creates a collection that contains a PrintSystemJobInfo object for each job in the queue.

Namespace:  System.Printing
Assembly:  System.Printing (in System.Printing.dll)

public PrintJobInfoCollection GetPrintJobInfoCollection()

Return Value

Type: System.Printing.PrintJobInfoCollection
Returns a PrintJobInfoCollection of PrintSystemJobInfo objects. There is one for each job in the queue.

The following example shows how to use this method when performing the same action on every job in a queue. For the full sample, see Diagnose Problematic Print Job Sample.

foreach (PrintQueue pq in myPrintQueues)
{
    pq.Refresh();
    PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();
    foreach (PrintSystemJobInfo job in jobs)
    {
        // Since the user may not be able to articulate which job is problematic, 
        // present information about each job the user has submitted. 
        if (job.Submitter == userName)
        {
            atLeastOne = true;
            jobList = jobList + "\nServer:" + line;
            jobList = jobList + "\n\tQueue:" + pq.Name;
            jobList = jobList + "\n\tLocation:" + pq.Location;
            jobList = jobList + "\n\t\tJob: " + job.JobName + " ID: " + job.JobIdentifier;
        }
    }// end for each print job    

}// end for each print queue

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Show: