Adding Timephased Actual Work through the PSI

There is some great content in the SDK on statusing (search for SubmitStatus and UpdateStatus) and even more coming soon.  One of the missing pieces just at the moment is around adding timephased data.  So here is a very brief example.  See the SDK for better examples of programmatically building the XML – but the key piece is the format of the XML passed to the statusing.UpdateStatus web service.  In my example I have a 5 day task assigned to me starting next Monday – and I want to update the actual work in my tasks to show 8h on Monday the 5th and 8h on Wednesday the 7th.  The XML for this change is as follows:- 

<Changes>

<Proj ID=”a3349ba9-7eb8-4921-9024-483d0a732f1a”>

<Assn ID=”dd6a2aa8-b754-48b5-a6fe-b5cd50cea19b”>

<PeriodChange PID=”251658250″  Start=”2007-02-05T08:00:00″ End=”2007-02-05T17:00:00″>480000</PeriodChange>

<PeriodChange PID=”251658250″  Start=”2007-02-07T08:00:00″ End=”2007-02-07T17:00:00″>480000</PeriodChange>

</Assn>

</Proj>

</Changes>

 

Where:-

·         a3349ba9-7eb8-4921-9024-483d0a732f1a is my Proj ID,

·         dd6a2aa8-b754-48b5-a6fe-b5cd50cea19b is my Assignment ID

·         The PID 251658250 means s_apid_actual_work (or Actual Work – from PSLibrary.AssnConstID.s_apid_actual_work – see SDK for more details of these constants)

·         Start and End time format is critical – the ULS logs are good at giving help when you get a LastError=StatusingInvalidChangelist Instructions exception.

·         480000 = 8 hours

 

 

So executing the statusing.UpdateStatus(changeXml); where the changeXml is the same as presented above will do exactly the same as entering the two lots of 8hrs in through PWA.  Tuesday will be updated to 0h planned work (because I have entered actual work for Wednesday)  – and 8h will be pushed back to next Monday.

Technorati Tags: