Second Life of a Hungarian SharePoint Geek

March 28, 2013

Limitations of the $expand REST query option when working with Project Server OData services

Filed under: Project Online, PS 2013, REST — Tags: , , — Peter Holpar @ 13:43

Recently I prepared a REST request for the ProjectData service of Project Server. I assembled the following simple query using LINQPad :

from a in Assignments
select new
{
  a.Resource.ResourceCanLevel,
  a.ProjectName,
  a.ResourceName
}

LINQPad sent the following query to the server:

http://yourProjectSite/_api/ProjectData/Assignments()?$expand=Resource&$select=Resource/ResourceCanLevel,ProjectName,ResourceName

The server responded with:

Unsupported query option encountered: $expand

I tried to submit a similar query, but specified exactly the property I needed (used Resource/ResourceCanLevel in place of former value Resource) in the $expand option:

http://yourProjectSite/_api/ProjectData/Assignments?$select=Resource/ResourceCanLevel,ResourceName,ProjectName&$expand=Resource/ResourceCanLevel

The response did not change.

Then – as a last desperate try – I’ve tried to simply omit the $expand option, like this:

http://yourProjectSite/_api/ProjectData/Assignments?$select=Resource/ResourceCanLevel,ResourceName,ProjectName

Of course, I’ve received this message:

Only properties specified in $expand can be traversed in $select query options

The reason and explanation for this behavior I found as a note on MSDN:

The ProjectData service does not implement the $links query option or the $expand query option. Excel 2013 internally uses the Association elements and the AssociationSet elements in the entity data model to help create associations between entities, for pivot tables and other constructs.”

Bad enough… The good news: the ProjectServer service (_api/ProjectServer) has no such limitation.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: