ProjectServerManager

ProjectServerManager class

The class which provides the methods to read and to perform operations on projects in the specified Project Online account or in the specified on-premise Project Server instance (Project Server’s versions 2016 and 2019 are supported).

public sealed class ProjectServerManager

Constructors

Name Description
ProjectServerManager(ProjectServerCredentials) Initializes a new instance of the ProjectServerManager class.

Methods

Name Description
CreateNewProject(Project) Creates new project in Project Server\Project Online instance using default save options.
CreateNewProject(Project, ProjectServerSaveOptions) Creates new project in Project Server\Project Online instance using the specified save options.
GetProject(Guid) Gets the project with the specified guid from the Project Online account \ Project Server instance.
GetProjectList() Gets the list of projects from ‘Working’ store of the current Project Online account \ Project Server instance.
GetProjectRawData(Guid) Gets the project’s binary data for troubleshooting purposes.
UpdateProject(Project) Updates existing project in Project Server\Project Online instance using default save options. The existing project will be overwritten.
UpdateProject(Project, ProjectServerSaveOptions) Updates existing project in Project Server\Project Online instance using the specified save options. The existing project will be overwritten.

Examples

Shows how to use Project Server manager to create a new project with predefined save options on Microsoft Project Online.

try
{
    const string sharepointDomainAddress = "https://contoso.sharepoint.com/sites/pwa";
    const string UserName = "admin@contoso.onmicrosoft.com";
    const string Password = "MyPassword";

    var credentials = new ProjectServerCredentials(sharepointDomainAddress, UserName, Password);

    var project = new Project(DataDir + @"Project1.mpp");

    var manager = new ProjectServerManager(credentials);
    var options = new ProjectServerSaveOptions
    {
        Timeout = TimeSpan.FromSeconds(10)
    };
    manager.CreateNewProject(project, options);
}
catch (ProjectOnlineException ex)
{
    Console.WriteLine(ex.Message);
}

See Also