Поделиться через


EntitySet: Assignments (ProjectData service)

In this article
Definition
Attributes
Parent element
Child elements

Specifies the collection of assignments in the ReportingData schema.

Definition

<EntitySet Name="Assignments" EntityType="ReportingData.Assignment" />

Attributes

Attribute

Value

Description

Name

Assignments

The name of the entity set.

EntityType

ReportingData.Assignment

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 Assignment 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 Assignments entity set can then be accessed as context.Assignments. For more information, see Querying OData feeds for Project 2013 reporting data.

var query =
    from a in Assignments
    orderby a.ProjectName, a.ResourceName
    select new
    {
        Project = a.ProjectName,
        Resource = a.ResourceName,
        AssignmentBookingType = a.AssignmentBookingName,
        AssignmentStartDate = a.AssignmentStartDate,
        Task = a.TaskName,
        AssignmentWork = a.AssignmentWork,
        AssignmentCost = a.AssignmentCost,
        AssisgnmentCostVariance = a.AssignmentCostVariance,
        AssignmentFinishVariance = a.AssignmentFinishVariance
    };

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

var query = Assignments
    .OrderBy(a => a.ProjectName)
    .ThenBy(a => a.ResourceName)
    .Select(a => new
    {
        Project = a.ProjectName,
        Resource = a.ResourceName,
        AssignmentBookingType = a.AssignmentBookingName,
        AssignmentStartDate = a.AssignmentStartDate,
        Task = a.TaskName,
        AssignmentWork = a.AssignmentWork,
        AssignmentCost = a.AssignmentCost,
        AssisgnmentCostVariance = a.AssignmentCostVariance,
        AssignmentFinishVariance = a.AssignmentFinishVariance
    });

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

https://ServerName/pwa/_vti_bin/client.svc/ProjectServerData/Assignments()?
    $orderby=ProjectName,ResourceName&            
    $select=ProjectName,ResourceName,AssignmentBookingName,AssignmentStartDate,TaskName,
    AssignmentWork,AssignmentCost,AssignmentCostVariance,AssignmentFinishVariance

All three of the sample queries get the same data.

Sample results of the Task query

Project

Resource

AssignmentBookingType

AssignmentStartDate

Task

AssignmentWork

AssignmentCost

AssignmentCostVariance

AssignmentFinishVariance

ProjectA

Res2

Committed

3/12/2012 8:00:00 AM

T1

24.0 hrs

$404.00

$0.00

0.0 hrs

ProjectA

Res7

Committed

3/12/2012 8:00:00 AM

T3

32.0 hrs

$564.00

$136.00

8.0 hrs

ProjectA

Res8

Committed

3/12/2012 8:00:00 AM

T2

8.0 hrs

$156.00

-$272.00

-16.0 hrs

ProjectB

Res3

Committed

3/19/2012 8:00:00 AM

T3

40.0 hrs

$740.00

$0.00

0.0 hrs

ProjectB

Res4

Proposed

3/19/2012 8:00:00 AM

T4

8.0 hrs

$168.00

-$168.00

-8.0 hrs

ProjectB

Res7

Committed

3/19/2012 8:00:00 AM

T1

48.0 hrs

$836.00

$272.00

16.0 hrs

ProjectB

Res8

Committed

3/19/2012 8:00:00 AM

T2

24.0 hrs

$428.00

$0.00

0.00

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.