Cascade Skyline - with Microsoft Logo and Project Support header - author Brian Smith

Adding Timephased Actual Work through the PSI

Adding Timephased Actual Work through the PSI

  • Comments 45

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:

Leave a Comment
  • Please add 6 and 2 and type the answer here:
  • Post
  • Hello, I get this error with help of PSClient error object:

    ----8<----

    System.Web.Services.Protocols.SoapException: ProjectServerError(s) LastError=StatusingInvalidChangelist Instructions: Pass this into PSClientError constructor to access all error information

      at Microsoft.Office.Project.Server.WebService.Statusing.SetAssignmentWorkData(String changeXML)

    PSCLientError Output:

    ErrId: StatusingInvalidChangelist

    Error attribute: Message: The 'PID' attribute is not declared.

    Error attribute: LineNumber: 0

    Error attribute: LinePosition: 0

    ----8<----

    Any ideas?

  • Hi Gernot,

    A quick pointer would be to check your XML for your changelist and confirm you have a valid PID and are using the correct parameters - it says you don't have a PID attribute declared.  I can't enter in to a long support incident via my blog but hopefully this will give you some clues as to where to look.

    Best regards,

    Brian.

  • Hi Brian,

    thank you very much for this helpful information. Updating actual work for work resources works fine.

    But updating actual costs (s_apid_actual_cost) for cost resources throws an GeneralUnhandledException SoapException.

    <Changes>

     <Proj ID="28906dc6-ae04-4238-ad4a-b2eea703ee6d">

       <Assn ID="111afc47-984b-4d2e-8470-714cb9eb2084">

           <PeriodChange PID="251658263" Start="2007-03-19T08:00:00" End="2007-03-19T17:00:00">7025</PeriodChange>

       </Assn>

     </Proj>

    </Changes>

    Best regards

    Mike

  • In our tests we are using the ChangeXML and we are logging in as FarmAdmin for our tests but we always get these kind of rights issues. Do you have any pointers for me?

    "The request failed with HTTP status 401: Unauthorized.","Could not set statusing data for "RALLS KIM" on project "ABCTEST"."

  • Actually figured part of this out.  We must run our Serivce as an Administrator to Project Server.  Not sure why yet, but definitely a rights issues somewhere.

  • Brian, In your example above, where does the start/end time come from?  If it's the working hours for the employee, how do you retrieve that info?  What if the employees work hours are 9-6 and he/she works 3 hours for would the time be 9-12?  Another question. What if the employee puts 4 more hours for day? Would the total be 7 of 4 work hours.  If 4, any way to increment so it shows 7?

  • This works great as long as I'm trying to update my own time.  Is there a way to update time for others?  I have full admin rights to Project Server 2007, but it looks like I need to dig into Impersonation to be able to put time into other resources Tasks page?

  • Yes John, you will need to use impersonation to do this.  See the SDK for details.

    Brian

  • Is there an equivalent way to update cost information for cost resources?  I don't see a PID value for costs, but it doesn't seem appropriate to enter "work" values for a cost resource.

  • Hi Brian,

    Thanks for posting a simple example of the changeXML structure.

    I have constructed one almost identical to it but it is throwing an exception: StatusingInvalidChangeList.

    Could it also throw that if I were not the assignment owner on the assignment it is trying to change (via the SetAssignmentWorkData(changeXML) method.

    Or would being the wrong user generate a different exception.

    The changeXML is:

    <Changes>

       <Proj ID="0A6F67D0-283E-44EB-93B0-1A594F017670">

           <Assn ID="70B8AD54-D19C-41E4-937E-5EDE442D159C">

               <PeriodChange PID="251658250" Start="2008-03-21T08:00:00" End="2008-03-21T17:00:00">60000</PeriodChange>

           </Assn>

       </Proj>

    </Changes>

    Surely, the case of the GUIDs doesn't matter, does it?

    Thanks for your help!

    Ken

  • FYI - the following is the C# code used to produce the above changeXML string:

               try

               {

                   string actStart = "2008-03-21" + "T08:00:00";

                   string actEnd = "2008-03-21" + "T17:00:00";

                   uint actual = PSLibrary.AssnConstID.s_apid_actual_work;

                   uint remaining = PSLibrary.AssnConstID.s_apid_remaining_work;

                   StringBuilder changeXml = new StringBuilder();

                   changeXml.AppendFormat("<Changes>", ProjID);

                   changeXml.AppendFormat("<Proj ID=\"{0}\">", ProjID);

                   changeXml.AppendFormat("<Assn ID=\"{0}\">", AssnID);

                   changeXml.AppendFormat("<PeriodChange PID=\"{0}\" Start=\"{1}\" End=\"{2}\">{3}</PeriodChange>", actual, actStart, actEnd, ActWorkValue);

                   changeXml.AppendFormat("</Assn>");

                   changeXml.AppendFormat("</Proj>");

                   changeXml.AppendFormat("</Changes>");

                   return changeXml.ToString();

               }

  • Hi,

    Can anybody tell me if Statusing Updates are possible on an assignment of a Project Resource (Not from the enterprise pool) to a Task, given that the user is the owner/creator of the Project and all the Tasks under it?

    Is it true that Statusing Updates are possible only on assignments of Enterprise Resources belonging to the Project Team and not on locally created Project Resources?

    Grateful for any help...

  • Hi Brian,

    I always get the same error when I enter any upate to one of the task in My Tasks in the Project Web Acess interface. I did not do any programming, and I do not use the SDK.

    Further, the actuals are not updated in the project file.

    Is this a bug?

  • Hi Wessel,

    It may be a bug - what error are you getting?

    Best regards,

    Brian

  • Hi Subramanian,

    It isn't possible to update local resources tasks through the statusing web service.  Even though they do show within Project Professional as having an Assignment Owner (the project owner/manager) this person does not see the assignments on My Tasks.  You can also confirm with the ChangeXML sample that these tasks are not visible.  You could use an enterprise resource in place of these local resources, but do not have them as "users" and set their assignment owner to the project owner manager.

    Best regards,

    Brian

Page 1 of 3 (45 items) 123