none
How to get a Task's “Unique ID” from a Project Web App via REST? RRS feed

  • Question

  • I'm fairly experienced developing for SharePoint, but I'm brand new to MS Project and Project Server / Project Web Apps.

    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. 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?



    • Edited by DylanCristy Tuesday, September 12, 2017 5:07 PM
    Tuesday, September 12, 2017 5:04 PM

Answers

All replies

  • Hello,

    Try the reporting API (_api/ProjectData rather than _api/ProjectServer):

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

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    • Marked as answer by DylanCristy Wednesday, September 13, 2017 1:11 PM
    Tuesday, September 12, 2017 8:29 PM
    Moderator
  • Is there something I need to turn on on the server to enable the reporting data?  I get a "Resource not found for the segment 'xxx'" error when I construct the query your way, or when I construct it the way shown here, which looks like:

    {PWA Site Url}/_api/projectdata/tasks?$filter=ProjectId eq guid'project-id-here'

    In the case of your format, the error segment is "projects", and in the second case, the error segment is "tasks", so it seems like anything under /projectdata/ is returning that error...

    Tuesday, September 12, 2017 9:18 PM
  • Nothing you need to turn on but there is a permission controlling access to it. If your an PWA Admin you will have access by default unless you have changed the default permissions.

    With the resource not found message it is usually because it can;t find that endpoint, if you PWA site in not in english you will need to use the localised name for Projects, Tasks, Assignments etc. or specify the locale like this:

    {PWA Site URL}/_api/ProjectData/[en-US]/Projects(guid'{project guid}')/Tasks()?$Select=TaskName,TaskId,TaskIndex,TaskClientUniqueId

    Or looking at your example URL, try using a capital T for /Tasks - it is case sensitive.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Wednesday, September 13, 2017 5:50 AM
    Moderator
  • It was the case sensitivity.

    Interesting that the ProjectData service is case sensitive, while the SharePoint REST services are not, and the ProjectServer services appear to be not case sensitive (at least from what I have seen so far).

    In any case, thank you!

    Wednesday, September 13, 2017 1:11 PM