Use the com.nomagic.magicdraw.teamwork.application.TeamworkUtils utility class to work with projects from Teamwork Server.

The Open API provides Teamwork Server accessing methods. The example of the code:

 	// check the logged user
    if (!user.equals(TeamworkUtils.getLoggedUserName()))
    {
        // login to the teamwork server
        if (!TeamworkUtils.login(server, -1, user, password))
        {
            // login failed return;
        }
    }
 
    // load a teamwork project
    ProjectDescriptor projectDescriptor = TeamworkUtils.getRemoteProjectDescriptorByQualifiedName(projectName);
    ProjectsManager projectsManager = Application.getInstance().getProjectsManager();
    projectsManager.loadProject(projectDescriptor, true); Project project = Application.getInstance().getProject();
    Model model = project.getModel();
 
    // get locked by a user
    Collection userLockedElements = TeamworkUtils.getLockedElement(project, user);
    if (!userLockedElements.contains(model))
    {
        // a model is not locked by a user, get all locked
        Collection allLockedElements = TeamworkUtils.getLockedElement(project, null);
        if (!allLockedElements.contains(model))
        {
            // a model is not locked, lock it
            TeamworkUtils.lockElement(project, model, false);
        }
    }
 
    SessionManager.getInstance().createSession("Rename Model");
    // change a name
    model.setName("MyModel");
    SessionManager.getInstance().closeSession();
    // unlcok and commit (because do not discard)
    TeamworkUtils.unlockElement(project, model, false, false);
    projectsManager.closeProject();
    // logout
    TeamworkUtils.logout();

 You can find the code examples in <modeling tool installation directory>\openapi\examples\teamwork