QueueSystem.ReadJobStatusSimple 方法
获取有关指定作业的 Project Server 队列的状态信息。
命名空间: WebSvcQueueSystem
程序集: ProjectServerServices(位于 ProjectServerServices.dll 中)
语法
声明
<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
用法
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
)
参数
jobUIDs
类型:[]队列作业 Guid 的数组。
includeWaitTime
类型:System.Boolean如果true,包括预期的工作等待时间。
返回值
类型:WebSvcQueueSystem.QueueStatusDataSet
对于每个作业的QueueStatusDataSet.StatusRow数据的请求作业的状态。
备注
ReadJobStatusSimple不使用作业组跟踪 ID。获取具有相同的跟踪 ID 的所有作业的状态的示例,请参阅ReadJobStatus。
Project Server 权限
以下权限之一是必需的。
权限 |
说明 |
---|---|
非标准 |
当前用户是作业所有者。 |
允许用户管理 Project Server 队列。全局权限。 |
示例
在以下示例中的GetStatusOfQueueJobs方法是在名为QueueSystemUtilities类。GetStatusOfQueueJobs是ReadJobStatus在示例相同的方法名称的重载。QueueSystemWS是QueueSystem Web 引用一个任意名称。
public WebSvcQueueSystem.QueueStatusDataSet GetStatusOfQueueJobs(
WebSvcQueueSystem.QueueSystem q,
Guid[] jobGuids,
bool includeWaitTime)
{
WebSvcQueueSystem.QueueStatusDataSet dsQStatus =
q.ReadJobStatusSimple(jobGuids, includeWaitTime);
return dsQStatus;
}
下面的代码段创建QueueCreateProject和QueuePublish方法的作业 Guid 的数组,,然后调用GetStatusOfQueueJobs,后者又调用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);
. . .
QueueStatusDataSet.Status表中列出jobGuids数组中的所有作业的状态。下表显示的某些字段Status表中运行前面代码之后。
队列 ID |
消息 类型 |
作业 完成 State |
队列 位置 |
百分比 完整 |
队列 进入时间 |
队列 处理 Time |
队列 已完成 Time |
Wait Time |
---|---|---|---|---|---|---|---|---|
1 |
22 |
4 |
-1 |
100 |
2011 年 6/28 下午 2:42 |
2011 年 6/28 下午 2:42 |
2011 年 6/28 下午 2:42 |
0 |
1 |
24 |
1 |
4 |
0 |
2011 年 6/28 下午 2:42 |
1 |
QueueMessageType 22 是ProjectCreate。作业不再队列 ;JobState 4 是Success。
QueueMessageType 24 是ProjectPublish。作业的第四个队列 ;JobState 1 是ReadyForProcessing。预期的等待时间为一秒。