次の方法で共有


EntitySet: Resources (ProjectData service)

In this article
Definition
Attributes
Parent element
Child elements

Specifies the collection of resources in the ReportingData schema.

Definition

<EntitySet Name="Resources" EntityType="ReportingData.Resource" />

Attributes

Attribute

Value

Description

Name

Resources

The name of the entity set.

EntityType

ReportingData.Resource

The type of entity.

Parent element

Element

Description

EntityContainer element: ReportingData

Contains definitions of entity sets for internal use in queries of the online Reporting database.

Child elements

None

Example

The following statement uses LINQ query syntax to retrieve Resource entity data from the OData interface of the Project Server reporting tables. To use the statement in an application, set a service reference to the ProjectDataService, and initialize the ReportingData context. The Resources entity set can then be accessed as context.Resources. For more information, see Querying OData feeds for Project 2013 reporting data.

var query =
    from r in Resources
    orderby r.ResourceName
    where (r.ResourceCount > (Int32)0)
    select new
    {
        ResourceName = r.ResourceName,
        ResourceEarliestAvailableFrom = r.ResourceEarliestAvailableFrom,
        ResourceStandardRate = r.ResourceStandardRate,
        ResourceMaxUnits = r.ResourceMaxUnits
    };

The preceding statement can be written by using Lambda expression syntax, as follows:

var query = Resources
    .OrderBy(r => r.ResourceName)
    .Where(r => (r.ResourceCount > (Int32)0))
    .Select(r => new
    {
        ResourceName = r.ResourceName,
        ResourceEarliestAvailableFrom = r.ResourceEarliestAvailableFrom,
        ResourceStandardRate = r.ResourceStandardRate,
        ResourceMaxUnits = r.ResourceMaxUnits
    });

Either statement creates the following REST URL (all on one line).

https://ServerName/pwa/_vti_bin/client.svc/ProjectServerData/Resources()?
    $orderby=ResourceName&
    $filter=ResourceCount gt 0&
    $select=ResourceName,ResourceEarliestAvailableFrom,ResourceStandardRate,ResourceMaxUnits

All three of the sample queries get the same data.

Sample results of the Resources query

ResourceName

ResourceEarliestAvailableFrom

ResourceStandardRate

ResourceMaxUnits

Resource1

3/4/2012 8:00:00 AM

$19.00

100%

Resource2

3/2/2012 8:00:00 AM

$18.00

100%

Resource3

3/3/2012 8:00:00 AM

$15.50

100%

Remarks

Each entity set has a specific page-size limit. For information about page limits for on-premises and online ProjectData queries and how to set the on-premises page limit, see ProjectData - OData service reference.