del método Workflow.ReadWorkflowStageList
Lee la lista de las fases de flujo de trabajo.
Espacio de nombres: WebSvcWorkflow
Ensamblado: ProjectServerServices (en ProjectServerServices.dll)
Sintaxis
'Declaración
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Workflow/ReadWorkflowStageList", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Workflow/", _
ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Workflow/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadWorkflowStageList As WorkflowDataSet
'Uso
Dim instance As Workflow
Dim returnValue As WorkflowDataSet
returnValue = instance.ReadWorkflowStageList()
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Workflow/ReadWorkflowStageList", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Workflow/",
ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Workflow/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public WorkflowDataSet ReadWorkflowStageList()
Valor devuelto
Tipo: WebSvcWorkflow.WorkflowDataSet
Comentarios
Cada WorkflowDataSet.WorkflowStageRow en la WorkflowDataSet.WorkflowStageDataTable contiene la información de una fase.
Permisos de Project Server
Permiso |
Descripción |
---|---|
Permite al usuario administrar flujos de trabajo. Permiso global. |
Ejemplos
The example uses the SvcWorkflow namespace in the ProjectServerServices.dll proxy assembly. The ConfigClientEndpoints method uses an app.config file for setting the WCF binding, behavior, and endpoint. For information about creating a PSI proxy assembly and an app.config file, see Prerequisites for WCF-Based Code Samples.
En el siguiente ejemplo se utiliza ReadWorkflowStageList para leer las etapas de flujo de trabajo existentes. El conjunto de datos resultante, workflowDS, contiene todas las fases y etapas en un flujo de trabajo y se escribe en el archivo WorkflowStageList.xml. A continuación es parte del archivo WorkflowStageList.xml.
<?xml version="1.0" standalone="yes"?>
<WorkflowDataSet xmlns="https://schemas.microsoft.com/office/project/server/webservices/WorkflowDataSet/">
<WorkflowPhase>
<PHASE_UID>d8bc257b-c2ec-4186-8a5b-44b5b7f21d82</PHASE_UID>
<PHASE_NAME>Create</PHASE_NAME>
<PHASE_DESCRIPTION>Project information is captured in this phase</PHASE_DESCRIPTION>
</WorkflowPhase>
<WorkflowStage>
<STAGE_UID>a8a158d1-a9b9-41d7-a676-d199118221c7</STAGE_UID>
<STAGE_NAME>TestStage</STAGE_NAME>
<PHASE_UID>d8bc257b-c2ec-4186-8a5b-44b5b7f21d82</PHASE_UID>
<PHASE_NAME>Create</PHASE_NAME>
<STAGE_DESCRIPTION>a test stage</STAGE_DESCRIPTION>
<CHECKIN_REQUIRED>false</CHECKIN_REQUIRED>
<STAGE_SUBMIT_DESCRIPTION />
<STATUS_PDP_UID>a7aa1c62-9577-447c-823e-bdb161f9000d</STATUS_PDP_UID>
</WorkflowStage>
A continuación se muestra el código de ejemplo completo.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ServiceModel;
namespace Microsoft.SDK.Project.Samples.WorkFlowTest
{
class WorkFlowProject
{
private static SvcWorkflow.WorkflowClient workFlowClient;
private const string WORK_ENDPOINT = "basicHttp_Workflow";
private const string OUTPUT_FILES = @"C:\Projects\Samples\Output\";
private static string outFilePathWorkFlowStageList;
private static string outFilePathNewWorkFlowStage;
private static string outFilePathStageInfo;
private static string outFilePathUpdatedStage;
static void Main(string[] args)
{
// Configure client endpoints.
ConfigClientEndpoints(WORK_ENDPOINT);
Guid[] workFlowID = new Guid[1];
workFlowID[0] = new Guid("e663d9dc-f78d-4a4e-ac21-b28d22865f58");
// If output directory does not exist, create it.
if (!Directory.Exists(OUTPUT_FILES))
{
Directory.CreateDirectory(OUTPUT_FILES);
}
outFilePathWorkFlowStageList = OUTPUT_FILES + "WorkFlowStageList.xml";
outFilePathNewWorkFlowStage = OUTPUT_FILES + "NewWorkflowStageInfo.xml";
outFilePathStageInfo = OUTPUT_FILES + "StageInfo.xml";
outFilePathUpdatedStage = OUTPUT_FILES + "UpdatedStage.xml";
// Create a workflow dataset.
SvcWorkflow.WorkflowDataSet workFlowDS = new SvcWorkflow.WorkflowDataSet();
// List the workflow stages.
workFlowDS = ListWorkflowStages(workFlowDS);
// Create a new workflow stage.
CreateWorkflowStageTest(workFlowDS);
// Get workflow stage properties for a given stage.
GetStageInfo();
}
// Read and display the properties of a stage, given the stage GUID.
private static void GetStageInfo()
{
SvcWorkflow.WorkflowDataSet stageInfoDS = new SvcWorkflow.WorkflowDataSet();
string stageName = "TestStage10";
Guid stageGuid1 = new Guid("a8a158d1-a9b9-41d7-a676-d199118221c7");
stageInfoDS = workFlowClient.ReadWorkflowStage(stageGuid1);
Console.WriteLine("\nSee XML output of the WorkFlowDataSet at {0}",
outFilePathStageInfo);
// Update the stage name.
UpdateStage(stageInfoDS, stageName, stageGuid1);
// Get the updated stage info.
stageInfoDS = workFlowClient.ReadWorkflowStage(stageGuid1);
stageInfoDS.WriteXml(outFilePathStageInfo);
Console.ReadKey();
}
// Update the stage name.
private static void UpdateStage(SvcWorkflow.WorkflowDataSet stageInfoDS, string stageName, Guid stageGuid1)
{
SvcWorkflow.WorkflowDataSet.WorkflowStageRow sRow;
sRow = stageInfoDS.WorkflowStage.FindBySTAGE_UID(stageGuid1);
sRow.STAGE_NAME = stageName;
Console.WriteLine("Updating the stage name........");
workFlowClient.UpdateWorkflowStage(stageInfoDS);
// Write the updated stage info to an xml file.
stageInfoDS.WriteXml(outFilePathUpdatedStage);
Console.WriteLine("Stage name updated!");
Console.WriteLine("\nSee XML output of the Updated WorkFlowDataSet at {0}",
outFilePathUpdatedStage);
}
// Create a workflow stage.
private static void CreateWorkflowStageTest(SvcWorkflow.WorkflowDataSet workFlowDS)
{
// The GUID of the Create phase.
Guid phaseGuid = new Guid("d8bc257b-c2ec-4186-8a5b-44b5b7f21d82 ");
Guid statusPDPId = new Guid("A7AA1C62-9577-447C-823E-BDB161F9000D");
Guid pdp_uid = new Guid("659FF164-1297-4B64-B813-489566774E27");
Guid stageUid = Guid.NewGuid();
// Create a workflow stage row.
SvcWorkflow.WorkflowDataSet.WorkflowStageRow workflowstageRow =
workFlowDS.WorkflowStage.NewWorkflowStageRow();
workflowstageRow.STAGE_NAME = "Test Stage 5";
workflowstageRow.STAGE_DESCRIPTION = "Adding a test stage row";
workflowstageRow.PHASE_NAME = "Create";
workflowstageRow.PHASE_UID = phaseGuid;
workflowstageRow.CHECKIN_REQUIRED = false;
workflowstageRow.STAGE_UID = stageUid;
workflowstageRow.STATUS_PDP_UID = statusPDPId;
workFlowDS.WorkflowStage.AddWorkflowStageRow(workflowstageRow);
// Add a project details page for the Stage created above.
SvcWorkflow.WorkflowDataSet.WorkflowStagePDPsRow pdpRow =
workFlowDS.WorkflowStagePDPs.NewWorkflowStagePDPsRow();
pdpRow.STAGE_UID = stageUid;
pdpRow.PDP_UID = pdp_uid;
pdpRow.PDP_NAME = "Project Information";
pdpRow.PDP_POSITION = 0;
pdpRow.PDP_ID = 4;
pdpRow.PDP_REQUIRES_ATTENTION = false;
workFlowDS.WorkflowStagePDPs.AddWorkflowStagePDPsRow(pdpRow);
// Create the stage.
workFlowClient.CreateWorkflowStage(workFlowDS);
// Write the dataset with the new Stage to an xml file.
workFlowDS.WriteXml(outFilePathNewWorkFlowStage);
Console.WriteLine("\nSee XML output of the WorkFlowDataSet at {0}",
outFilePathNewWorkFlowStage);
}
// List the workflow stages in the dataset.
private static SvcWorkflow.WorkflowDataSet ListWorkflowStages(SvcWorkflow.WorkflowDataSet workFlowDS)
{
workFlowDS = workFlowClient.ReadWorkflowStageList();
workFlowDS.WriteXml(outFilePathWorkFlowStageList);
Console.WriteLine("\nSee XML output of the WorkFlowDataSet at {0}",
outFilePathWorkFlowStageList);
return workFlowDS;
}
// Configure the custom field client endpoints.
public static void ConfigClientEndpoints(string endpt)
{
workFlowClient = new SvcWorkflow.WorkflowClient(endpt);
}
}
}