ProjectResourcesReplace Method

Description

The PDS replaces the resource or resources directly in the Microsoft Office Project Server 2003 database for the requested project. The PDS removes the current resource, and then adds the replacement resource to the project and shifts all of the assignments from the current resource to the replacement resource.

To replace a resource in a project, the user must first check out the project from Project Server.

The call fails if any of the requested resources have reported actual work in the project plan (in the database Project tables) or has pending actual work (in the database Web tables). If one resource replacement fails for any reason, the entire ProjectResourcesReplace call fails.

Syntax

<Request>
   <ProjectResourcesReplace>
      <AutoPublish></AutoPublish>
      <ProjectID></ProjectID>
      <ProjectName></ProjectName>
      <Resources>
         <Resource>
            <Name></Name>
            <EUID></EUID>
            <ReplacementName></ReplacementName>
            <ReplacementEUID></ReplacementEUID>
         <Resource>
      </Resources>
   </ProjectResourcesReplace>
</Request>

Parameters

For each resource, if the EUID is given, the Name is ignored, even if given.

AutoPublish is an optional parameter that is valid for the entire call and automatically calls the PDS method ProjectViewTablesCreate for the updated project in order to synchronize the project with the view tables. AutoPublish defaults to 0.

AutoPublish

Optional. The default value is 0. If AutoPublish is set to 1, the PDS calls ProjectViewTablesCreate to properly synchronize the project with the Project Server view tables after all of the resources have been replaced. AutoPublish is set for the entire call.

ProjectID* or *ProjectName

Required. ProjectResourcesReplace must include either the ProjectID or the ProjectName. If ProjectID is specified, ProjectName is ignored, even if given. ProjectName is the concatenation of the project name and the version name with a period separator (that is, Name.Version).

Name* or *EUID

Required. Either the resource name or the Enterprise Unique ID is required for at least one resource. If EUID is specified, Name is ignored, even if given.

ReplacementName* or *ReplacementEUID

Required. Either the resource replacement name or EUID is required for each resource to be replaced. If ReplacementEUID is specified then ReplacementName is ignored, even if given.

Note   Each resource pair must have exactly one current resource and one replacement resource. Multiple resource pairs are valid.

Return Value

If the requested resource creation is successful, the method returns a successful HRESULT and STATUS.

<Reply>
   <HRESULT></HRESULT>
   <STATUS></STATUS>
   <UserName></UserName>
</Reply>

Remarks

Before the PDS replaces resources, it determines whether the user permissions are valid on Project Server and whether the user has checked out the requested project. The PDS then checks that each resource exists in the project.