Figuring out the ChangeXML format when using the 'UpdateStatus' method
The Statusing web service (Project Server Interface) in EPM2007 contains a powerful method called UpdateStatus. This method can be used to make changes to tasks and assignments; for instance: Actual Work, % Work Complete, ... please refer to the ChangeList Schema Reference in the SDK for a complete list.
To help you generate the XML string required to achieve your customization needs the latest version of the SDK has a powerful tool that will help you generate the ChangeXML command: How to: Generate ChangeXML for Statusing Updates
Your customization will ideally generate the proper ChangerXML command dynamically based on the entities you need to update.
A sample method to generate the ChangeXML string could look like this:
public static StringBuilder CreateChangeXml(TimeSheetWS.TimesheetDataSet timesheetDs)
{
StringBuilder changeXml = new StringBuilder();
string pidRegularWork = PSLibrary.AssnConstID.s_apid_regular_work.ToString(System.Globalization.CultureInfo.InvariantCulture);
changeXml.AppendFormat("<Changes>");
for (int i = 0; i < timesheetDs.Lines.Count; i++)
{
if (timesheetDs.Lines[i].TS_LINE_VALIDATION_TYPE == (int)PSLibrary.TimesheetEnum.ValidationType.Verified)
{
changeXml.AppendFormat("<Proj ID=\"{0}\">", timesheetDs.Lines[i].PROJ_UID.ToString());
changeXml.AppendFormat("<Assn ID=\"{0}\">", timesheetDs.Lines[i].ASSN_UID.ToString());
changeXml.AppendFormat("<Change PID=\"{0}\">{1}</Change>", pidRegularWork, timesheetDs.Lines[i].TS_LINE_ACT_SUM_VALUE.ToString(System.Globalization.CultureInfo.InvariantCulture));
changeXml.Append("</Assn></Proj>");
}
}
changeXml.Append("</Changes>");
return changeXml;
}