none
CSOM to add resource rate RRS feed

Answers

  • hi Kirk,

    here is an example: 

    EnterpriseResource res = this.context.EnterpriseResources.GetByGuid(id);

    this.context.Load(res);

           this.context.Load(res.CostRateTables, t => t.IncludeWithDefaultProperties(rt => rt.CostRates));

     

           var existingRatesA = this.context.LoadQuery(res.CostRateTables.GetByName(CostRateTableName.A).CostRates.Where(rate => rate.EffectiveStarting == effectiveDateOfExistingCostRate));

    res.CostRateTables.GetByName(CostRateTableName.A).CostRates.Add(

    new CostRateCreationInformation()

                  {

                  EffectiveDate = DateTime.Today,

                  StandardRate = 25.0,

                  OvertimeRate = 36.5,

                  CostPerUse = 150

                  });

          this.server.EnterpriseResources.Update();

          this.context.ExecuteQuery();


    tatiana

    Tuesday, March 7, 2017 6:29 PM

All replies

  • Hello,

    yes this should be possible using this version (or later) of the Project CSOM DLL:

    https://dev.office.com/blogs/new-sharepoint-csom-version-released-for-Office-365-january-2017

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Friday, March 3, 2017 4:35 PM
    Moderator
  • hi Kirk,

    here is an example: 

    EnterpriseResource res = this.context.EnterpriseResources.GetByGuid(id);

    this.context.Load(res);

           this.context.Load(res.CostRateTables, t => t.IncludeWithDefaultProperties(rt => rt.CostRates));

     

           var existingRatesA = this.context.LoadQuery(res.CostRateTables.GetByName(CostRateTableName.A).CostRates.Where(rate => rate.EffectiveStarting == effectiveDateOfExistingCostRate));

    res.CostRateTables.GetByName(CostRateTableName.A).CostRates.Add(

    new CostRateCreationInformation()

                  {

                  EffectiveDate = DateTime.Today,

                  StandardRate = 25.0,

                  OvertimeRate = 36.5,

                  CostPerUse = 150

                  });

          this.server.EnterpriseResources.Update();

          this.context.ExecuteQuery();


    tatiana

    Tuesday, March 7, 2017 6:29 PM
  • hi Kirk,

    here is an example: 

    EnterpriseResource res = this.context.EnterpriseResources.GetByGuid(id);

    this.context.Load(res);

           this.context.Load(res.CostRateTables, t => t.IncludeWithDefaultProperties(rt => rt.CostRates));

     

           var existingRatesA = this.context.LoadQuery(res.CostRateTables.GetByName(CostRateTableName.A).CostRates.Where(rate => rate.EffectiveStarting == effectiveDateOfExistingCostRate));

    res.CostRateTables.GetByName(CostRateTableName.A).CostRates.Add(

    new CostRateCreationInformation()

                  {

                  EffectiveDate = DateTime.Today,

                  StandardRate = 25.0,

                  OvertimeRate = 36.5,

                  CostPerUse = 150

                  });

          this.server.EnterpriseResources.Update();

          this.context.ExecuteQuery();


    tatiana

    Hi tatiana, wich dlls must we use in visual basic?
    Wednesday, June 7, 2017 9:03 AM
  • Hi Ware,

    Add the latest CSOM dll..

    Microsoft.ProjectServer.Client

    Refer the below link for information.

    https://dev.office.com/blogs/new-sharepoint-csom-version-released-for-Office-365-january-2017

    --

    Rajkumar.

    Tuesday, October 31, 2017 5:50 AM
  • It didn't work for me. Could you explain this line? Also, what's the value of effectiveDateOfExistingCostRate?

    var existingRatesA =this.context.LoadQuery(res.CostRateTables.GetByName(CostRateTableName.A).CostRates.Where(rate => rate.EffectiveStarting == effectiveDateOfExistingCostRate));

    Thanks,

    Thursday, March 21, 2019 9:25 PM