Using the updated ChangeXML utility for Statusing

The Statusing methods in the Project Server Interface (PSI) in Microsoft Project Server 2010 enable one user to read, submit, and update assignment and task status for another user, without resorting to impersonation. In the Project Server 2007 SDK, the How to: Generate ChangeXML for Statusing Updates article shows how to generate the changeXml parameter for the UpdateStatus method, validate the XML, and use the ReadStatus and SubmitStatus methods. The Project 2007 SDK download includes the complete Visual Studio 2005 solution for the ChangeXML utility. However, the ChangeXML utility could only update status for the current user.

The ChangeXML utility  is now updated for Project Server 2010, in the attached ChangeXMLUtility.zip file. With it, you can generate the changeXml parameter and update status for the current user or for another user. To update status for another user, the utility uses the ReadStatusForResource and UpdateStatusForResource methods. In addition, the utility checks whether the current user has the global StatusBrokerPermission security permission, adds the ResID attribute to the changeXml parameter, and validates the XML against the updated ChangeList.xsd schema in Project Server 2010. For more information about the ChangeList.xsd schema, see Introduction to the ChangeList Schema and Statusing ChangeXML.

Note: The ChangeXML utility is designed for use only on a test installation of Project Server 2010, as an example of a programming utility for statusing. It should not be used on a production installation.

The updated ChangeXML utility also has several other changes. The previous version uses the ASMX interface, which was the only choice available for Project Server 2007. In the updated version, you can choose to programmatically initialize the WCF interface of the PSI by entering the Project Web App URL, or by using the WCF endpoint values in the app.config file. In the following screenshot, the login is automatic if you use the app.config value.

        ChangeXML_LogOn_AppConfig

Note: To use the app.config file, change the URL to the value for your PWA instance, for each PSI service endpoint.

In the main window, after you log on Project Server, choose Build Change XML.

        ChangeXML_Main_Empty

You can choose to update the status of available assignments for the current user, or – if you have the StatusBrokerPermission – you can choose another user and update assignments for that user. In the following screenshot, the update is for another user. The Items available for update list shows the Project name : Task name : User name values for each item. You can choose to update assignment values or task values for that assignment. The Generate a Change dialog box shows different controls in the Update section, depending on what kind of update you choose. For example, if you choose to update an assignment custom field, you can choose the custom field and the lookup table value, if the custom field uses a lookup table.

        ChangeXML_Generate_4User_Assign_HealthCF

When you choose Update XML, the tool generates the changeXml parameter value, as follows:

        ChangeXML_Main_4User_Assign_HealthCF

Following is the changeXml parameter value in the case shown, for updating the Health assignment custom field. Note that the XML value includes the ResID attribute for the Assn element.

 <Changes xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema">
  <Proj ID="a3e78597-2302-45fc-bb15-7f23d74efdf8">
    <Assn ID="b001d2d9-69eb-49a0-aa9f-6bbe53f9484c"
           ResID="aa3a6f6f-bb70-4d2e-92da-b06580ae6376">
      <LookupTableCustomFieldChange IsMultiValued="false"
             CustomFieldType="Text" 
            CustomFieldGuid="00004f6d-90a2-439a-8cc2-1c1ef6d2da4f"
             CustomFieldName="Health">
        <LookupTableValue
               Guid="0000c45d-8a43-4eb0-9b74-e535b391988a">Late</LookupTableValue>
      </LookupTableCustomFieldChange>
    </Assn>
  </Proj>
</Changes>

You can clear the Run Update check box to just validate the changeXml parameter. For example, manually change one of the elements, attributes, or values in the XML, and see if it still validates. Or, you can check Run Update to validate and run the change.

When the change is completed, try opening the project in Project Professional. If you are the project manager, you are prompted to review the status change in PWA. If you accept the change in PWA, to see the change, open the project in Project Professional. For example, if you changed the Health assignment custom field, go the the Task Usage view, and then add the Health field to the view.

        WinProj_OpenProject_AssnHealthCF_Changed

After you save and publish the project, you can also see the change in the Reporting database. For example, run the following query in SQL Server Management Studio for the RDB:

 SELECT TOP 1000 [AssignmentUID]
      , [ResourceUID]
      , [Health_T]
    FROM [ProjectServer_Reporting].[dbo].[MSP_EpmAssignment_UserView]

Find the correct assignment and resource GUIDs in the Results pane:

SQLSrv_ReportingDB_EpmAssignment

The ChangeXML utility is useful for creating and testing values of the changeXml parameter for the UpdateStatus method,
where you can create and test changes for the current user and for other Project Server 2010 users. It also contains code examples
that show how to check for a security permission of a resource and use statusing methods.

Updating the ChangeXML utility

Here are the main steps that were used to update the application from Project Server 2007 to 2010. The user interface had only
minor tweaks, because that was not an issue for a test tool.

  1. Open in Visual Studio 2010 to update the solution; change the target to .NET Framework 3.5.
  2. Add a reference to the updated ProjectServerServices.dll, which contains a proxy WCF interface of the PSI services.
  3. Remove ASMX initialization; initialize PSI services for WCF (programmatic and/or with app.config). This step is not
    essential, but the WCF interface is recommended for moving forward.
  4. Modify the login dialog box; use the WCFHelpers.dll assembly from ProjTool for login routines. The ProjTool code for
    Project Server 2010 is in the SDK download.
    Note: The logon routines for Forms authentication are not updated in this sample.
  5. Get and display the StatusBrokerPermission value for the current user. Enable the Update for user option if the current
    user has the correct permission.
  6. Get the list of active resources, by using ReadUserList; add the ResourceItem class for combobox display and values.
  7. Refresh the list of items to update, by using ReadStatusForResource.
  8. Add ResID to classes for generating and displaying the changeXml parameter (ChangesProj, ChangesProjAssn,
    ChangesProjTask, and Items).
  9. Remove the empty ResID attribute in the changeXml value for the current user.
  10. Run statusing updates for a selected user, by using SubmitStatusForResource.
  11. Test

In actuality, testing occurs after each step is completed.

—Jim Corbin

ChangeXMLUtility.zip