none
Custom Fields not visible in CSOM RRS feed

  • Question

  • I am currently working on an application that synchronizes timesheets between Project Server and a third-party timesheet tool.

    Now I am looking up a EnterpriseResource using the CustomField value like this. Basically I am comparing this value with a string, and if found the EnterpriseResource will be used to synchronize CalendarExceptions.

    var projectContext = ProjectServerHelper.GetProjectContext(Company);
                var resources = projectContext.EnterpriseResources;
                projectContext.Load(resources);
                projectContext.ExecuteQuery();
    
                EnterpriseResource resource = null;
                var found = false;
                for (var i = 0; i < resources.Count && !found; i++)
                {
                    resource = (EnterpriseResource)resources.ElementAt(i);
                    if (resource.FieldValues[_psCustomFieldInternalNameTiaUsername].Equals(tiaUsername))
                    {
                        found = true;
                    }
                }

    When I run this code in a separate solution, I am able to find the CustomField and read the value of the EnterpriseResource I am looking for. When I am using the code in my entire solution, the application itself, the application crashes with a KeyNotFoundException.

    When I debug my application, I can see that the CustomField value I am trying to read is not even visible or present.

    When I go check in Project Server 2013 or Project Online, the CustomField is clearly there and filled in for all EnterpriseResources.

    I have been banging my head over this for one week now. Is it possible that I may have a ProjectContext connection still open somewhere, preventing me to read the CustomField?


    Jonas Hendrickx

    Wednesday, March 9, 2016 7:10 AM