PWA O365: Accessing data in Custom data field using OData

%3CLINGO-SUB%20id%3D%22lingo-sub-2625786%22%20slang%3D%22en-US%22%3EPWA%20O365%3A%20Accessing%20data%20in%20Custom%20data%20field%20using%20OData%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2625786%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20my%20MS%20Project%20file%20(Project%20Web%20App%20%3CA%20href%3D%22https%3A%2F%2Fenvironmentnswgov.sharepoint.com%2Fsites%2Fspace%2FElectricity%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2F%5Btenant%5D.sharepoint.com%2Fsites%2Fspace%2F%3C%2FA%3E%5BProgram%20Name%5D%3CSPAN%3E%2F)%20I%20can%20read%20the%20list%20of%20custom%20fields%20using%20PowerBI%20ODataFeed.%20The%20PowerBI%20(PowerQuery)%20code%20is%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3ESource%20%3D%20ODataFeed(%22%3CA%20href%3D%22https%3A%2F%2Fenvironmentnswgov.sharepoint.com%2Fsites%2Fspace%2FElectricity%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2F%5Btenant%5D.sharepoint.com%2Fsites%2Fspace%2F%3C%2FA%3E%5BProgram%20Name%5D%2FProjects('%5BProject%20ID%5D')%2FTasks('Task%20ID')%2FCustomFields%22%2C%20null%2C%20%5BImplementation%3D%222.0%22%5D)%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20returns%20table%20with%20the%20list%20of%20custom%20fields%20names%2C%20their%20properties%20and%20their%20AppAlternateIDs%20(whatever%20that%20means)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I%20cannot%20find%20a%20way%20to%20read%20the%20values%20of%20those%20custom%20fields%20for%20the%20tasks.%20I%20have%20tried%20things%20like%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3ESource%20%3D%20ODataFeed(%22%3CA%20href%3D%22https%3A%2F%2Fenvironmentnswgov.sharepoint.com%2Fsites%2Fspace%2FElectricity%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2F%5Btenant%5D.sharepoint.com%2Fsites%2Fspace%2F%3C%2FA%3E%5BProgram%20Name%5D%2FProjects('%5BProject%20ID%5D')%2FTasks('Task%20ID')%2FCustomFields('AppAlternateID')%22%2C%20null%2C%20%5BImplementation%3D%222.0%22%5D)%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20that%20simply%20returns%20the%20relevant%20row%20from%20the%20table%20I%20get%20in%20the%20previous%20step%20(without%20using%20the%20'AppAlternateID'%20in%20the%20URI)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20googling%20it%20and%20many%20people%20are%20scratching%20their%20heads%20for%20an%20answer.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2628267%22%20slang%3D%22en-US%22%3ERe%3A%20PWA%20O365%3A%20Accessing%20data%20in%20Custom%20data%20field%20using%20OData%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2628267%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1123546%22%20target%3D%22_blank%22%3E%40Asim_H%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EFor%20reporting%2C%20use%20the%20ProjectData%20API%3A%26nbsp%3Bhttps%3A%2F%2F%5Btenant%5D.sharepoint.com%2Fsites%2Fspace%2F%5BProgram%20Name%5D%2F_api%2FProjectData%20-%20you%20will%20see%20lots%20of%20tables%20%2F%20endpoints%20here.%3C%2FP%3E%0A%3CP%3EUse%20the%20Projects%20table%20%2F%20endpoint%20to%20get%20Project%20level%20details%3A%26nbsp%3Bhttps%3A%2F%2F%5Btenant%5D.sharepoint.com%2Fsites%2Fspace%2F%5BProgram%20Name%5D%2F_api%2FProjectData%2FProjects%3C%2FP%3E%0A%3CP%3EUse%20the%20Tasks%20table%20%2F%20endpoint%20to%20get%20Task%20level%20details%3A%26nbsp%3Bhttps%3A%2F%2F%5Btenant%5D.sharepoint.com%2Fsites%2Fspace%2F%5BProgram%20Name%5D%2F_api%2FProjectData%2FTasks%3C%2FP%3E%0A%3CP%3EPaul%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

In my MS Project file (Project Web App https://[tenant].sharepoint.com/sites/space/[Program Name]/) I can read the list of custom fields using PowerBI ODataFeed. The PowerBI (PowerQuery) code is below:

 

Source = ODataFeed("https://[tenant].sharepoint.com/sites/space/[Program Name]/Projects('[Project ID]')/Tasks('Task ID')/CustomFields", null, [Implementation="2.0"])

 

It returns table with the list of custom fields names, their properties and their AppAlternateIDs (whatever that means)

 

But I cannot find a way to read the values of those custom fields for the tasks. I have tried things like

 

Source = ODataFeed("https://[tenant].sharepoint.com/sites/space/[Program Name]/Projects('[Project ID]')/Tasks('Task ID')/CustomFields('AppAlternateID')", null, [Implementation="2.0"])

 

But that simply returns the relevant row from the table I get in the previous step (without using the 'AppAlternateID' in the URI)

 

I have been googling it and many people are scratching their heads for an answer.

3 Replies

Hello @Asim_H ,

For reporting, use the ProjectData API: https://[tenant].sharepoint.com/sites/space/[Program Name]/_api/ProjectData - you will see lots of tables / endpoints here.

Use the Projects table / endpoint to get Project level details: https://[tenant].sharepoint.com/sites/space/[Program Name]/_api/ProjectData/Projects

Use the Tasks table / endpoint to get Task level details: https://[tenant].sharepoint.com/sites/space/[Program Name]/_api/ProjectData/Tasks

Paul

 

Thanks @Paul Mather . I'm not sure what is the difference between the ProjectServer vs. ProjectData but I can't get the list of custom fields using the ProjectServer.

Anyway, I'm already using those end points that you mentioned. As noted in my original post, the issue is really with getting the values of custom fields linked to the Tasks (I..e added columns in the schedule). That's where some example or documentation of the ODATA for PWAs would be helpful.

Hello @Asim_H ,

/ProjectServer is the CRUD API whereas the /ProjectData API is the read / reporting API. Are you just reading data or wanting to update it?

Paul