Click or drag to resize

ProjectOperationsMoveWorkPackage Method

Move a work package to another control account.

Namespace:  Cobra.WebService.ClientAPI.Application.Files
Assembly:  Cobra.WebService.ClientAPI (in Cobra.WebService.ClientAPI.dll) Version: 8.4.717.3176 (8.4.0717.3176)
Syntax
C#
public ServiceResult MoveWorkPackage(
	MoveWorkPackageServiceArguments moveWorkPackageserviceArguments
)

Parameters

moveWorkPackageserviceArguments
Type: Cobra.Model.WebServiceMoveWorkPackageServiceArguments
An instance of MoveWorkPackageServiceArguments class that contains the options to move a work package.

Return Value

Type: ServiceResult
The result of moving the work package.
Examples
This example shows how to move a work package.
C#
using Cobra.Model.WebService;
using Cobra.WebService.ClientAPI.Application.Files;
using Cobra.WebService.ClientAPI.Client;

.
.
.

CobraServices cobraServices = new CobraServices();
cobraServices.ServiceIdentityData.Username = "SYSADMIN";
cobraServices.ServiceIdentityData.SecurePassword = new SecurePassword();
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('P');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('A');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('W');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('O');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('R');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('D');
cobraServices.ServiceIdentityData.DataSourceKey = "COBRA";

LoginResult loginResult = cobraServices.Login();
if (!loginResult.Success) {
    Console.WriteLine("Login failed.");
    return;
}

Console.WriteLine("Login Success.");

ProjectOperations projectOperations = cobraServices.CreateServiceOperations<ProjectOperations>();
MoveWorkPackageServiceArguments moveWorkPackageServiceArguments = projectOperations.CreateProjectOperationsServiceArguments<MoveWorkPackageServiceArguments>();
moveWorkPackageServiceArguments.Project = "Demo Advanced";
moveWorkPackageServiceArguments.SourceControlAccountId1 = "1.1.2.1";
moveWorkPackageServiceArguments.SourceControlAccountId2 = "1600";
moveWorkPackageServiceArguments.SourceWorkPackageId = "04";
moveWorkPackageServiceArguments.TargetControlAccountId1 = "1.1.2.2";
moveWorkPackageServiceArguments.TargetControlAccountId2 = "1600";
moveWorkPackageServiceArguments.TargetWorkPackageId = "04";
moveWorkPackageServiceArguments.Log.ChangeNumber = "1";
moveWorkPackageServiceArguments.Log.LogComment = "Move WP 1.1.2.1 / 1600 / 04 to 1.1.2.2 / 1600 / 04";
moveWorkPackageServiceArguments.Log.Significant = false;

Console.WriteLine("Moving Work Package...");
ServiceResult serviceResult = projectOperations.MoveWorkPackage(moveWorkPackageServiceArguments);
if (serviceResult.Success)
    Console.WriteLine("Work Package moved successfully.");
else
    Console.WriteLine("Work Package did not moved successfully.");

cobraServices.Logout();
See Also