ReadStatusForResource problem RRS feed

  • Question

  • Hi there!

    I'm using the UpdateStatus and SubmitStatusForResource methods to set the actual work for an assignment and resource. This works fine. The problem is when I want to call the ReadStatusForResource method.

    For example I submit status for day 1 with 5 hours of actual work, then I do the same for day 2 with 3 hours. When I try to read status I'm always getting 8 hours of actual work, independently the dates I pass to the ReadStatusForResource method.

    How can I get only the work of one day?

    Thank you.

    Monday, May 28, 2012 11:17 AM

All replies

  • Hi,

    Here is my code if anyone can help me.

    First I have a function to register the time worked:

    private static void UpdateWork(ProjectWebSvc.ProjectDataSet projectDs, ProjectWebSvc.Project projectSvc, StatusingWebSvc.Statusing statusingSvc)
        Guid projId = new Guid("1d2830ae-01c6-4119-a525-23377eecac69");
        Guid asigId = new Guid("268A0F2D-30E5-43E4-8539-A8E19023914C");
        Guid resId = new Guid("B5BC24C4-660C-4D9F-9980-3773B4B5BEBE");
        string changeXml = CreateChangeXml(projId, asigId, resId);
        statusingSvc.SubmitStatusForResource(resId, new Guid[] { asigId }, "Trabajo actualizado");
    private static string CreateChangeXml(Guid projUid, Guid assnUid, Guid resUid)
        StringBuilder cXmlBuilder = new StringBuilder("<Changes>");
        cXmlBuilder.AppendFormat("<Proj ID=\"{0}\">", projUid.ToString());
        cXmlBuilder.AppendFormat("<Assn ID=\"{0}\"", assnUid.ToString());
        cXmlBuilder.AppendFormat(" ResID=\"{0}\">", resUid.ToString());
        string pidPctWorkComplete = PSLibrary.AssnConstID.s_apid_actual_work.ToString(System.Globalization.CultureInfo.InvariantCulture);
        cXmlBuilder.AppendFormat("<PeriodChange PID=\"{0}\" Start=\"2012-05-22T00:00:00\" End=\"2012-05-22T23:59:59\">{1}</PeriodChange>", pidPctWorkComplete, 300 * 1000);
        cXmlBuilder.AppendFormat("<PeriodChange PID=\"{0}\" Start=\"2012-05-23T00:00:00\" End=\"2012-05-23T23:59:59\">{1}</PeriodChange>", pidPctWorkComplete, 180 * 1000);
        return cXmlBuilder.ToString();

    Then when I try to read the status for one day, I'm always getting a value of 480000. It doesn't matter the dates I pass to the ReadStatusForResource method:

    StatusingWebSvc.StatusingDataSet statusingDs = new StatusingWebSvc.StatusingDataSet();
    statusingDs = statusingSvc.ReadStatusForResource(resId, asigId, new DateTime(2012, 05, 22), new DateTime(2012, 05, 22));

    What is wrong? or how can I get the value for the day 22 only? Is this the correct way to do it or which one is the correct way?

    Thank you!

    Tuesday, May 29, 2012 8:34 AM
  • The dates you pass with the ReadStatusForResource method only filter the set of status updates, they do not filter the actual period for which you will retrieve actuals. That is, as actuals are cumulative within statusing - you would need to look into the timephased data to see actuals per day.

    Jan Cirpka

    Thursday, May 31, 2012 12:55 PM
  • Thanks for your answer Jan,

    But the ReadStatusTimephasedData method reads data for only the current logged-on resource, so I have to impersonate. Is there no way to get the actual work for any resource without impersonate?


    Friday, June 1, 2012 9:50 AM
  • As far as I know impersonation is indeed the only way. Depending of your scenario this should not be of to much hassle. The major drawback of your scenario could be a whole series of PSI calls (but the number would not be different between ReadStatusStatusForResource or ReadStatus - as both only collect data for a single resource).

    Instead of using the PSI you might wish to consider using the reporting database. This would allow you to obtain datasets that join information of various projects and resources with a single call.

    Jan Cirpka

    Friday, June 1, 2012 1:08 PM
  • Yes, after write you I was looking the reporting database tables and I see that the table, MSP_EpmAssignmentByDay, can give the necessary information directly.

    Anyway, I'll try do impersionation. Where can I find an simple example for impresionation using ASMX?


    Friday, June 1, 2012 2:38 PM
  • LyE, the SDK includes a sample on Impersonation ( Once you have gone through the initial 'setup' work impersonation is not a big deal. Another sample can be found here: 

    Jan Cirpka

    Monday, June 4, 2012 8:39 AM