ProjectCollection class
inherits members from ClientObjectCollection
Represents a collection of PublishedProject objects.
Syntax
CSOM
class ProjectCollection
JSOM
PS.ProjectCollection
REST Interface
Supported.
PS.ProjectCollection
http://contoso.sharepoint.com/sites/pwa/api/ProjectServer/Projects
Members
✓ - Read Support ✓ʷ - Write Support
Properties
Name | .NET | JSOM | REST | Type | Description |
---|---|---|---|---|---|
[Integer] | ✓ | PublishedProject | Gets a PublishedProject from the collection at the specified index. | ||
Item | ✓ | PublishedProject | Gets a PublishedProject from the collection at the specified index. |
Methods
Name | .NET | JSOM | REST | Return Type | Description |
---|---|---|---|---|---|
'{PublishedProjectId}' | ✓ | PublishedProject | Gets a PublishedProject from the collection with the specified PublishedProjectId. | ||
Add(ProjectCreationInformation parameters) | ✓ | ✓ | ✓ | PublishedProject | Adds the PublishedProject that is specified by the ProjectCreationInformation object to the collection. |
GetByGuid(Guid uid) | ✓ | ✓ | ✓ | PublishedProject | Gets a PublishedProject from the collection with the Guid value. |
GetById(String objectId) | ✓ | ✓ | ✓ | PublishedProject | Gets a PublishedProject from the collection with the Id value. |
Remove(PublishedProject project) | ✓ | ✓ | Boolean | Removes the specified PublishedProject from the collection. | |
Update() | ✓ | ✓ | QueueJob | Updates the project collection. | |
Validate() | ✓ | ✓ | ✓ | void | Validates pending changes to the project and all of the entities that it contains without saving them. |
#### Method Details
'{PublishedProjectId}'
Gets a PublishedProject from the collection with the specified PublishedProjectId.
Syntax
PublishedProject http://contoso.sharepoint.com/sites/pwa/api/ProjectServer/Projects('{PublishedProjectId}')
Parameters
Name | Type | Description |
---|---|---|
PublishedProjectId | String | the id of the PublishedProject |
Return Value
Add(ProjectCreationInformation parameters)
Adds the PublishedProject that is specified by the ProjectCreationInformation object to the collection.
Syntax
PublishedProject Add(ProjectCreationInformation parameters)
Parameters
Name | Type | Description |
---|---|---|
parameters | ProjectCreationInformation | The properties that can be set when creating a published project. |
Return Value
GetByGuid(Guid uid)
Gets a PublishedProject from the collection with the Guid value.
Syntax
PublishedProject GetByGuid(Guid uid)
Parameters
Name | Type | Description |
---|---|---|
uid | Guid | The Guid of the PublishedProject |
Return Value
PublishedProject
The PublishedProject with the specified guid.
GetById(String objectId)
Gets a PublishedProject from the collection with the Id value.
Syntax
PublishedProject GetById(String objectId)
Parameters
Name | Type | Description |
---|---|---|
objectId | String | The id of the PublishedProject. |
Return Value
PublishedProject
The PublishedProject with the specified ID.
Remove(PublishedProject project)
Removes the specified PublishedProject from the collection.
Syntax
Boolean Remove(PublishedProject project)
Parameters
Name | Type | Description |
---|---|---|
project | PublishedProject | The PublishedProject to remove. |
Return Value
Boolean
Update()
Updates the project collection.
Syntax
QueueJob Update()
Parameters
None
Return Value
QueueJob
The QueueJob includes the JobState property that identifies the result of the update request.
Validate()
Validates pending changes to the project and all of the entities that it contains without saving them.
Syntax
void Validate()
Parameters
None
Return Value
void
Remarks
Project Server creates a virtual PublishedProject object for each draft project that has not yet been published. A virtual published project ensures that a draft project can be retrieved through the ProjectCollection object, whether it has been published or not.
For example, if you create a draft project, and then read all projects with the CSOM, ProjectCollection object contains the unpublished draft project.
You can determine whether a project has been published by the value of the PublishedProject.LastPublishedDate property, which is inherited from Project.LastPublishedDate. For an unpublished project, the LastPublishedDate property value is DateTime.Min (1/1/0001).