共用方式為


QueueSystem.ReadJobStatusSimple Method

Gets status information about the specified jobs on the Project Server queue.

Namespace:  [QueueSystem Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/QueueSystem.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/QueueSystem.asmx?wsdl

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/ReadJobStatusSimple", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadJobStatusSimple ( _
    jobUIDs As Guid(), _
    includeWaitTime As Boolean _
) As QueueStatusDataSet
'Usage
Dim instance As QueueSystem
Dim jobUIDs As Guid()
Dim includeWaitTime As Boolean
Dim returnValue As QueueStatusDataSet

returnValue = instance.ReadJobStatusSimple(jobUIDs, _
    includeWaitTime)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/ReadJobStatusSimple", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public QueueStatusDataSet ReadJobStatusSimple(
    Guid[] jobUIDs,
    bool includeWaitTime
)

Parameters

  • jobUIDs
    Type: []
    Array of queue job GUIDs.
  • includeWaitTime
    Type: System.Boolean
    If true, include the expected job wait time.

Return Value

Type: [QueueSystem Web service].QueueStatusDataSet
Status of the requested jobs, with the QueueStatusDataSet.StatusRow data for each job.

Remarks

ReadJobStatusSimple does not use a tracking ID for job groups. For an example of getting the status of all jobs with the same tracking ID, see ReadJobStatus.

Project Server Permissions

One of the following permissions is required.

Permission

Description

Non-standard

The current user is the job owner.

ManageQueue

Allows the user to manage the Project Server queue. Global permission.

Examples

The GetStatusOfQueueJobs method in the following example is in a class named QueueSystemUtilities. GetStatusOfQueueJobs is an overload of the same method name in the example for ReadJobStatus. QueueSystemWS is an arbitrary name of the QueueSystem Web reference.

public WebSvcQueueSystem.QueueStatusDataSet GetStatusOfQueueJobs(
    WebSvcQueueSystem.QueueSystem q,
    Guid[] jobGuids,
    bool includeWaitTime)
{
    WebSvcQueueSystem.QueueStatusDataSet dsQStatus = 
        q.ReadJobStatusSimple(jobGuids, includeWaitTime);
    return dsQStatus;
}

The following code fragment creates an array of job GUIDs for the QueueCreateProject and QueuePublish methods, and then calls GetStatusOfQueueJobs, which in turn calls ReadJobStatusSimple.

using System.Threading;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
private static ProjectWS.Project project = 
            new ProjectWS.Project();
private static QueueSystemWS.QueueSystem queueSystem =
    new QueueSystemWS.QueueSystem(); 
private static QueueSystemUtils queueSystemUtils = new QueueSystemUtils();
. . .
ProjectWS.ProjectDataSet dsProject =
    new ProjectWS.ProjectDataSet();
ProjectWS.ProjectDataSet.ProjectRow projectRow =
    dsProject.Project.NewProjectRow();

Guid projectGuid = Guid.NewGuid();
projectRow.PROJ_UID = projectGuid;
projectRow.PROJ_NAME = this.txtProjectName.Text;
projectRow.PROJ_TYPE =
    Convert.ToInt32(PSLibrary.Project.ProjectType.Project);

dsProject.Project.AddProjectRow(projectRow);

// Create GUIDs for the queue job and for tracking multiple jobs.
Guid jobGuidCreateProject = Guid.NewGuid();
Guid trackingGuid = Guid.NewGuid();

bool validateOnly = false;
string queueStatus = "";
// Create and save project to the Draft database.

project.QueueCreateProject(jobGuidCreateProject, dsProject, validateOnly);
// Wait a few seconds, or create a WaitForQueue method.
Thread.Sleep(3000);

ProjectWS.ProjectRelationsDataSet dsProjectRelations =
    new ProjectWS.ProjectRelationsDataSet();
Guid jobGuidPublish = Guid.NewGuid();

string wssUrl = "" // Default SharePoint project workspace. 
bool fullPublish = true;

// Publish the project to the Published database.
dsProjectRelations = project.QueuePublish(jobGuidPublish, projectGuid, fullPublish, wssUrl);

Thread.Sleep(500);

Guid[] jobGuids = { jobGuidCreateProject, jobGuidPublish };

WebSvcQueueSystem.QueueStatusDataSet dsQStatus =
    queueSystemUtils.GetStatusOfQueueJobs(queueSystem, jobGuids, includeWaitTime);
. . .

The QueueStatusDataSet.Status table lists the status of all jobs in the jobGuids array. The following table shows some of the fields in the Status table after running the previous code.

Queue

ID

Message

Type

Job

Completion

State

Queue

Position

Percent

Complete

Queue

Entry Time

Queue

Processing

Time

Queue

Completed

Time

Wait

Time

1

22

4

-1

100

6/28/2011

2:42 PM

6/28/2011

2:42 PM

6/28/2011

2:42 PM

0

1

24

1

4

0

6/28/2011

2:42 PM

1

QueueMessageType 22 is ProjectCreate. The job is no longer on the queue; JobState 4 is Success.

QueueMessageType 24 is ProjectPublish. The job is fourth on the queue; JobState 1 is ReadyForProcessing. The expected wait time is one second.

See Also

Reference

QueueSystem Class

QueueSystem Members

QueueSystem Web Service

ReadJobStatus

Other Resources

How to: Use the QueueSystem Service