Plumtree EDK (Enterprise Web Development Kit) 5.4.0

IProjectManager.CopyProjectContent Method 

Copies all the project content of the source project to the target project.

void CopyProjectContent(
   IProject sourceProject,
   IProject targetProject,
   DateShiftTypes dateShiftType,
   TimeZone timezone,
   string documentHistoryComment
);

Parameters

sourceProject
The source project, cannot be null and has to be persisted prior to call.
targetProject
The target project, cannot be null and has to be persisted prior to call.
dateShiftType
A DateShiftTypes specifying how dates in the source project should be shifted to dates in the target project; cannot be null. Please see documentation in DateShiftTypes class for more details.
timezone
Information for interpreting some of source dates. This should be set to the Time Zone of the user on whose behalf the copying is being done.; cannot be null.
documentHistoryComment
A String that will be used as the initial comment in the document history of each of the copied documents.

Remarks

This asynchronous method will do a best-attempt effort to copy all the objects in the source project. If an error occurs while copying one of the objects, the copying will continue with appropriate exceptions thrown after the copy process finishes.

This method may only be invoked on behalf of a user who is a project leader in both the source and the target projects.

The project data that is copied is:
  1. All document folders
  2. All documents
  3. All discussions (but not the discussion messages)
  4. All task lists
  5. All tasks
Prior to the call, both the source and target project have to be a persisted IProject, and also both projects have to have the start date set, otherwise an CollaborationException will be thrown. The copied project will be stored permanently. No Store method will be required to call on the copied object.

Security is mapped isomorphically from the source project to the target project. Thus if the ProjectMember role in the source project has access level i on object O, and object O is copied to object O', then the ProjectMember role in the target project will have access level i on object O'. Similarly with the ProjectGuest role.

Example code:

Sample code for copying projects
// get the projects
IProject sourceProject = projectManager.GetProject(sourceProjectID);
IProject targetProject = projectManager.GetProject(targetProjectID);

//use DateShiftType of NONE for no date conversions DateShiftType dateShiftType = DateShiftType.NONE;

//use the default timezone- see docs for other options TimeZone timezone = TimeZone.CurrentTimeZone; try { projectManager.CopyProjectContent(sourceProject, targetProject, dateShiftType, timezone); } catch (Exception e) { if (e instanceof MultipleObjectException) { //get the source exception from each exception MultipleObjectException multException = (MultipleObjectException) e; int[] ids = multException.ObjectIds; //loop through the exceptions find the cause exception, e.g. Exception causeException = multException.GetCauseException(ids[i]); } else { //deal with other exceptions...... } }

Exceptions

Exception TypeCondition
PermissionDeniedException The user is not a Project Leader in both the source and target project.
InvalidOperationException if either of the projects have not yet been stored or have already been removed.
CollaborationException if the method call resulted in an error, or if the user does not have Read access to one of the projects.
MultipleObjectException if errors occurred while copying. Each source exception can be retrieved from this exception. The exception should never happen unless source project content is being accessed concurrently with this copy operation.
SoapException if there is a communication problem during the execution of the remote method call.

See Also

IProjectManager Interface | Plumtree.Remote.PRC.Collaboration.Project Namespace