I am tasked with retrieving OData from a Microsoft Project server. Following Querying OData feeds for Project reporting data I have been able to retrieve all of the default Microsoft Project fields for each project. Each default field column can be found in the metadata on project server.
Now I need to access the custom fields for the objects at each level. I have used the linq and context below:
WebDCWater.ProjectOData.ReportingData context =
new WebDCWater.ProjectOData.ReportingData(new Uri(PSDATA, UriKind.Absolute));
var proj = context.Projects
.OrderBy(p => p.ProjectName).Select(p => p).FirstOrDefault();
This query gets me the default column values for each project (ProjectEndDate, ProjectDuration, ProjectName, etc). However, I need to access custom fields that are not found in the metadata.
How can I expand my service reference to include custom fields? Is there something that needs to change on the project-server side?
According to MSDN, custom fields and relationships should be included in the service reference:
When you set a service reference to ProjectData, or query ~/ProjectData/$metadata, the Entity Data Model (EDM, or OData schema) includes custom field properties at the time the reference is made.