none
Access resource “CostRateTables” using SharePoint CSOM from on-premise MS Project Server RRS feed

  • Question

  • Hi

    I am developing Web Service in VS 2015.

    In that web service, I want to retrieve "CostRateTables" of resource and update some values in it. I am getting below error in code: 'EnterpriseResource' does not contain a definition for 'CostRateTables'

    I am referring below DLL's in my web service project:

    1. Microsoft.ProjectServer.Client (15.0.0.0)
    2. Microsoft.SharePoint.Client (15.0.0.0)
    3. Microsoft.SharePoint.Client.Runtime (15.0.0.0)

    Code:

    public static string pwaInstanceUrl = "http://XXX.XXX.com/sites/PWA";
    public static string userName = "XXXX";
    public static string passWord = "XXXX";
    public static string domain = "XXXX";
    private static ProjectContext context;
    
    context = new ProjectContext(pwaInstanceUrl);
    
    NetworkCredential netcred = new NetworkCredential(userName, passWord,domain);
    context.Credentials = netcred;
    
    EnterpriseResource res = context.EnterpriseResources.GetByGuid(Object_GUID);
    context.Load(res);
    
    context.Load(res.CostRateTables, t => t.IncludeWithDefaultProperties(rt => rt.CostRates));

    I am able to connect with server and retrieve the list of projects using below code snippet:

    public static string pwaInstanceUrl = "http://XXX.XXX.com/sites/PWA";
    public static string userName = "XXXX";
    public static string passWord = "XXXX";
    public static string domain = "XXXX";
    private static ProjectContext context;
    
    context = new ProjectContext(pwaInstanceUrl);
    
    NetworkCredential netcred = new NetworkCredential(userName, passWord,domain);
    context.Credentials = netcred;
    
    context.Load(context.Projects);
    context.ExecuteQuery();
    
    foreach (PublishedProject project in context.Projects)
                {
                    Console.WriteLine("Project Name - '" + project.Name.ToString() + "'");
                }

    Please suggest.



    Best Regards, Somnath


    Friday, April 14, 2017 1:56 PM

Answers

All replies