Project.ReadSchedulingContext Method

Gets the scheduling context based on a set of projects and resources.

Namespace:  [Project Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/Project.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/Project.asmx?wsdl

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Project/ReadSchedulingContext", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Project/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Project/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadSchedulingContext ( _
    projectUids As Guid(), _
    resourceUids As Guid() _
) As ProjectContextDataSet
'Usage
Dim instance As Project
Dim projectUids As Guid()
Dim resourceUids As Guid()
Dim returnValue As ProjectContextDataSet

returnValue = instance.ReadSchedulingContext(projectUids, _
    resourceUids)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Project/ReadSchedulingContext", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Project/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Project/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public ProjectContextDataSet ReadSchedulingContext(
    Guid[] projectUids,
    Guid[] resourceUids
)

Parameters

  • projectUids
    Type: []
    An array of project GUIDs.
  • resourceUids
    Type: []
    An array of resource GUIDs.

Return Value

Type: [Project Web service].ProjectContextDataSet
Contains the scheduling context that is derived from the specified projects and resources.

Remarks

Gets a list of projects that are related to specified projects or resources. A relationship exists if one of the following conditions is met:

  • Projects share enterprise resources (either those on the project team or in the input list).

  • Projects have interproject dependencies (cross-project links).

  • Projects share resources with or have cross-project links with projects that are related to projects in the input list (an indirect relationship).

Project Server Permissions

Permission

Description

OpenProject

Allows a user to open the specified projects. Category permission.

Examples

Consider two projects that share one enterprise resource, as in the following table.

Project name and GUID

Resources and GUIDs

Project1

f0e98e26-2c9c-4f74-b40a-640f3f3f03f5

Resource1; d58fd816-d380-46e3-aff1-6cef617d32a2

Resource2; b3dab395-bc33-4dd7-a3a7-a45522857369

 

Project2

a9d03b87-37f1-473d-90f6-77ba3c521a40

Resource1; d58fd816-d380-46e3-aff1-6cef617d32a2

 

In the following code fragment for a test application, [Project Web service] is an arbitrary name for a reference to the Project web service, and project is an initialized instance of the [Project Web service].Project class.

try
{
    Guid[] projectUids = { new Guid("a9d03b87-37f1-473d-90f6-77ba3c521a40") };
    Guid[] resourceUids = null;
    
    WebSvcProject.ProjectContextDataSet dsProjectContext =
        project.ReadSchedulingContext(projectUids, resourceUids);
    dsProjectContext.WriteXml(@"C:\Tests\SchedulingContextOut.txt");
}
catch (SoapException ex)
{
    . . .
}

The value of the Relationship element in the SchedulingContextOut.txt file shows that Project2 is related to Project1 by a shared resource. If you add one or both resource GUIDs to the resourceUids array, the result is the same.

Note

If you add both project GUIDs to the projectUids array, dsProjectContext is empty.

<?xml version="1.0" standalone="yes"?>
<ProjectContextDataSet xmlns="https://schemas.microsoft.com/office/project/server/webservices/ProjectContextDataSet/">
  <Relationships>
    <PROJ_UID>a9d03b87-37f1-473d-90f6-77ba3c521a40</PROJ_UID>
    <RelatedTo_UID>f0e98e26-2c9c-4f74-b40a-640f3f3f03f5</RelatedTo_UID>
    <RelatedTo_NAME>Project1</RelatedTo_NAME>
    <Relationship>2</Relationship>
    <HasBuildTeamPermission>true</HasBuildTeamPermission>
  </Relationships>
</ProjectContextDataSet>

See Also

Reference

Project Class

Project Members

Project Web Service

ProjectContextDataSet.RelationshipsRow.Relationship