PrintSystemJobInfo.JobIdentifier 属性

定义

获取打印作业的标识号。

public:
 property int JobIdentifier { int get(); };
public int JobIdentifier { get; }
member this.JobIdentifier : int
Public ReadOnly Property JobIdentifier As Integer

属性值

一个标识打印作业的 Int32

示例

以下示例演示如何在诊断打印作业的问题时使用此属性。

for each (PrintQueue^ pq in myPrintQueues)
{
   pq->Refresh();
   PrintJobInfoCollection^ jobs = pq->GetPrintJobInfoCollection();
   for each (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;
      }
   }
}
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
For Each pq As PrintQueue In myPrintQueues
    pq.Refresh()
    Dim jobs As PrintJobInfoCollection = pq.GetPrintJobInfoCollection()
    For Each job As PrintSystemJobInfo 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 Then
            atLeastOne = True
            jobList = jobList & vbLf & "Server:" & line
            jobList = jobList & vbLf & vbTab & "Queue:" & pq.Name
            jobList = jobList & vbLf & vbTab & "Location:" & pq.Location
            jobList = jobList & vbLf & vbTab & vbTab & "Job: " & job.JobName & " ID: " & job.JobIdentifier
        End If
    Next job ' end for each print job

Next pq ' end for each print queue

注解

使用哪个编号系统取决于打印服务器的操作系统以及打印服务器是计算机还是打印服务器设备。 例如,Microsoft Windows XP 的操作系统以这种方式确定编号:打开打印服务器时,如果打印服务器的所有打印队列都为空,则任何用户在服务器上提交的第一个打印作业以及分配给任何队列的 ID 为 2。 为服务器上的每个后续作业分配一个数字,该数字比该服务器上的上一个打印作业大 1。

打印作业的打印队列对其数量没有影响:如果按顺序将作业发送到 QueueA、QueueB 和 QueueA,则 QueueA 具有作业 2 和 4,QueueB 具有作业 3。

为作业分配数字后,该数字永远不会更改,即使其他作业完成打印或取消,或者服务器重启也是如此。 如果重启服务器时,一个或多个队列中已有作业,则会为第一个新作业分配一个数字,该数字比服务器启动时队列中编号最高的作业多一。 但是,在重新启动之前,打印服务器不会重用数字。 即使编号最高的作业在打印之前被取消,下一个作业也会得到一个更高的数字。

适用于