using System; using TestFramework.ApplicationAPI; using TestFramework.AuthenticateAPI; using TestFramework; namespace Tests.wbs { /// <summary> /// Summary description for WBSTaskCPTP. /// /// This sample loads a project from RPM repository and /// makes a copy proposed to plan action on the project. /// </summary> public class WBSTaskCPTP { public WBSTaskCPTP() { } public static String projectName = "IBM_GENERIC_PROJECT_ABC"; //Session ID is use for all transaction and is get from the //Authenticate.login function. The session ID will replace // the User password while transacting public static String sessionid; public void sampleTest() { // initialize a session with the API sessionid = APISetup.SetUp(); // create a project scope // this scope enables us to save information // around the project WorkElementScope tScope = new WorkElementScope(); // create a project object Project project = new Project(); // query the project project = (Project)APISetup.application.loadFromXpath( sessionid, "/Project[name='" + projectName + "']", tScope ).rpmObjectList[0]; // run method copy proposed to plan on the project // with the use of a scope, this method can affect // many objects in a logical tree if (APISetup.application.copyProposedToPlan(sessionid, project, tScope).taskSuccessfull) { //copy proposed to plan worked and enabled // modification of actual and forecast dates } // close connection with API APISetup.CleanUp(sessionid); } } }