How to get a Task's "Unique ID" from a Project Web App via REST?

1.5k views Asked by At

I'm a fairly experienced SharePoint developer, but brand new to MS Project and Project Server / PWA.

In MS Project Pro, there is a column called "Unique ID" that seems to function like SharePoint's built-in list item "ID" field - an auto-incrementing integer (1 based).

How can I find a task's "Unique ID" from a project that has been saved and published to a Project Web App through Project Server's REST API?

The only "ID" on a Task object retrieved through

https://servername/pwa/_api/projectserver/projects('project-id')/tasks('task-id')

is a GUID, there doesn't seem to be any property associated with an integer ID.

I found this other question and answer over on the MSDN help site. It is about Project Server 2010, and about how to show the "Unique ID" field in a report. But the answer says (emphasis mine):

There are three ID fields in the MSP_EpmTask_UserView; TaskUID, TaskIndex and TaskClientUniqueId. TaskUID is a GUID, TaskIndex corresponds to the Task positional ID and TaskClientUniqueId corresponds to the Unique Id field in Project Professional.

So it appears that this information is stored somewhere within Project Server, but... how do I get it through REST?

2

There are 2 answers

0
Dylan Cristy On BEST ANSWER

Well, although the other answer here is correct, some explanation might be in order.

Project Server has two different REST endpoints, and they do not return the same data.

There is

<PWA site URL>/_api/ProjectServer/

and

<PWA site URL>/_api/ProjectData/

There is quite a bit of overlap in the data they return, but there are some fields that can only be retrieved through the ProjectServer endpoint, and there are some fields that can only be retrieved through the ProjectData endpoint.

As it turns out, TaskClientUniqueId can only be retrieved from the /_api/ProjectData/ endpoint.

2
Abhishek Jangid On
{PWA Site URL}/_api/ProjectData/Projects(guid'{project guid}')/Tasks()?$Select=TaskName,TaskId,TaskIndex,TaskClientUniqueId