Connecting a Project to a Project Server
Using Trados GroupShare, projects can be shared between many users within an organization. The Automation API provides methods for publishing and accessing server-based projects.
Server-based projects are not accessed directly but through a local copy. Interaction with files in a project through the local copy is just like interacting with a standard project. However additional steps are required to check in, check out files so they are available to all project users.
Publishing to a Project Server
To share a project on Project Server the project must be published to the server. To do this through the Project Automation API requires calling the PublishProject method on the FileBasedProject object.
In general you will call this method only after you have performed all the necessary project preparation tasks however it can be done at any point after the project has been created.
The following example shows how to publish the project to a server.
project.PublishProject(
new Uri("http://myServerAddress:80"),
true,
"MyUserName",
"MyPassword",
"/MyOrganization",
(obj, evt) =>
{
Console.WriteLine(evt.StatusMessage + " " + evt.PercentComplete + "% complete");
if (cancelledByUser)
{
evt.Cancel = true;
}
});
Note
Once a project has been published the local project will become the workspace for this project and you will only need to create a new workspace if you access the project from another machine or you delete the existing workspace.
Opening a new server project (no local copy available).
If you do not already have a local copy for a server project you must open the project using the OpenProject method in the ProjectServer class. This will create the workspace and return a FileBasedProject object.
The following example shows how to open a server-based project if no pre-existing local copy exists. To use this method, you need the unique id of the project on the server and the path on your local file system where you wish to create the local copy.
FileBasedProject SetupServerProjectLocalCopy(Guid projectId, string locationOfLocalCopy)
{
Uri serverAddress = new Uri("http://myServerAddress:80");
ProjectServer server = new ProjectServer(serverAddress, false, "MyUser", "MyPassword");
FileBasedProject project = server.OpenProject(projectId, locationOfLocalCopy);
return project;
}
Note
Opening the project from the server only downloads the necessary files to describe the contents of the project and any project settings. The actual source and target files are not automatically downloaded to the local copy.
Note
If you already have a workspace attached to a server project then you should create a new FileBasedProject using the constructor for this purpose
Opening a server project from an existing local copy.
If you already have a local copy of a server project you can open the project using the constructor designed for this purpose on the FileBasedProject
class.
The following example shows how to open a server-based project from an existing local copy.
FileBasedProject project = new FileBasedProject(@"c:\MyProjectDirectory\MyProjectFile.sdlproj", false, "MyUserName", "MyPassword");
See Also
Viewing and Deleting Published Projects