none
Get Project StartDate and EndDate using CSOM in Project Server RRS feed

  • Question

  • Hi,

    I am trying to get the project StartDate and EndDate using the LINQ query annd ProjectContext Object of the CSOM.

    When I am using the following line.

    var projColl = projContext.Load(my Linq query to get any project);

    projContext.ExecuteQuery();

    Publishedproject pp = projColl.First();

    DraftProject dp  = pp.CheckOut();

    Date startDate = dp.StartDate;

    It is giving me an exception saying the property has not been initialized. Please provide pointers on how to load this property.

    Any help on how to get the custom field value would also be helpful as I am getting thee same exception even after I have used the following lines of code

    projContext.Load(dp.CustomFields)

    projContext.ExecuteQuery();

    With this I am able to get the CustomField Name but no the value.

    Thanks in advance.

    Regards,

    Divyang Agrawal


    Thursday, September 12, 2013 6:01 AM

Answers

  • Hi,

    Found the solution for the same.

    we have to use the below lines:-

    DraftProject dp  = pp.CheckOut();

    projContext.Load(dp, d=>d.startDate);

    projeContext.ExecuteQuery();

    Date startDate = dp.StartDate;

    Regards,

    Divyang Agrawal

    Monday, December 2, 2013 7:10 AM