public final class ProjectServerManager extends Object
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).
Constructor and Description |
---|
ProjectServerManager(ProjectServerCredentials credentials)
Initializes a new instance of the
ProjectServerManager class. |
Modifier and Type | Method and Description |
---|---|
void |
createNewProject(Project project)
Creates new project in Project Server\Project Online instance using default save options.
|
void |
createNewProject(Project project,
ProjectServerSaveOptions saveOptions)
Creates new project in Project Server\Project Online instance using the specified save options.
|
Project |
getProject(UUID projectGuid)
Gets the project with the specified guid from the Project Online account \ Project Server instance.
|
com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ProjectInfo> |
getProjectList()
Gets the list of projects from 'Working' store of the current Project Online account \ Project Server instance.
|
InputStream |
getProjectRawData(UUID projectGuid)
Gets the project's binary data for troubleshooting purposes.
|
void |
updateProject(Project project)
Updates existing project in Project Server\Project Online instance using default save options.
|
void |
updateProject(Project project,
ProjectServerSaveOptions saveOptions)
Updates existing project in Project Server\Project Online instance using the specified save options.
|
public ProjectServerManager(ProjectServerCredentials credentials) throws IOException
Initializes a new instance of the ProjectServerManager
class.
This example shows how to create instance of ProjectServerManager to access on-premise instance of Project Server.[C#] string site = "http://project_server_instance.local/"; var windowsCredentials = new NetworkCredential("Administrator", "my_password", "DOMAIN"); var projectServerCredentials = new ProjectServerCredentials(site, windowsCredentials); ProjectServerManager manager = new ProjectServerManager(projectServerCredentials);
This example shows how to create instance of ProjectServerManager to access account in Project Online service.[C#] var credentials = new ProjectServerCredentials("https://xxxxxx.sharepoint.com", "yyyyy@xxxxxxx.onmicrosoft.com", "password"); ProjectServerManager manager = new ProjectServerManager(projectServerCredentials);
credentials
- Credentials used to connect to Project Online account.IOException
public final void createNewProject(Project project) throws Exception
Creates new project in Project Server\Project Online instance using default save options.
In this example the project is loaded from .mpp file and saved to Project Online account.[C#] var credentials = new ProjectServerCredentials("https://xxxxxx.sharepoint.com", "yyyyy@xxxxxxx.onmicrosoft.com", "password"); var project = new Project(@"sample.mpp"); ProjectServerManager manager = new ProjectServerManager(credentials); manager.CreateNewProject(project);
project
- The project to save to Project Server\Project Online instance.ProjectOnlineException
- In case of communication error or error returned by a server.Exception
public final void createNewProject(Project project, ProjectServerSaveOptions saveOptions) throws Exception
Creates new project in Project Server\Project Online instance using the specified save options.
In this example the project is loaded from .mpp file and saved to Project Online account.[C#] var credentials = new ProjectServerCredentials("https://xxxxxx.sharepoint.com", "yyyyy@xxxxxxx.onmicrosoft.com", "password"); var project = new Project(@"sample.mpp"); ProjectServerManager manager = new ProjectServerManager(credentials); manager.CreateNewProject(project, new ProjectServerSaveOptions { ProjectName = "My new project" });
project
- The project to save to Project Server\Project Online instance.saveOptions
- Instance of ProjectServerSaveOptions
class.ProjectOnlineException
- In case of communication error or error returned by a server.Exception
public final Project getProject(UUID projectGuid) throws Exception
Gets the project with the specified guid from the Project Online account \ Project Server instance.
public final com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ProjectInfo> getProjectList()
Gets the list of projects from 'Working' store of the current Project Online account \ Project Server instance.
public final InputStream getProjectRawData(UUID projectGuid)
Gets the project's binary data for troubleshooting purposes.
In this example the debug info for the specific project is retrieved. You can pass the resulting "debug.zip" to the support team for troubleshooting purposes. [C#] var credentials = new ProjectServerCredentials("https://xxxxxx.sharepoint.com", "yyyyy@xxxxxxx.onmicrosoft.com", "password"); // Guid of project you are trying to get. var projectGuid = new Guid("e0294bfb-5657-45c8-9cc5-82169fb95d69"); ProjectServerManager manager = new ProjectServerManager(credentials); using (var fileStream = File.OpenWrite(@"c:\debug.zip")) { using (var stream = manager.GetProjectRawData(projectGuid)) { stream.CopyTo(fileStream); } }
projectGuid
- The Guid of the project to read.public final void updateProject(Project project) throws Exception
Updates existing project in Project Server\Project Online instance using default save options. The existing project will be overwritten.
In this example the project is loaded from Project Online account, modified and saved back to Project Online account.[C#] var credentials = new ProjectServerCredentials("https://xxxxxx.sharepoint.com", "yyyyy@xxxxxxx.onmicrosoft.com", "password"); ProjectServerManager manager = new ProjectServerManager(credentials); var projectList = manager.GetProjectList(); var projectGuid = projectList.First().Id; var project = manager.GetProject(projectGuid); var task = project.RootTask.Children.Add("New task"); manager.UpdateProject(project);
project
- The project to save to Project Server\Project Online instance.
ProjectOnlineException
- In case of communication error or error returned by a server.Exception
public final void updateProject(Project project, ProjectServerSaveOptions saveOptions) throws Exception
Updates existing project in Project Server\Project Online instance using the specified save options. The existing project will be overwritten.
In this example the project is loaded from Project Online account, modified and saved back to Project Online account.[C#] var credentials = new ProjectServerCredentials("https://xxxxxx.sharepoint.com", "yyyyy@xxxxxxx.onmicrosoft.com", "password"); ProjectServerManager manager = new ProjectServerManager(credentials); var projectList = manager.GetProjectList(); var projectGuid = projectList.First().Id; var project = manager.GetProject(projectGuid); var task = project.RootTask.Children.Add("New task"); manager.UpdateProject(project, new ProjectServerSaveOptions { ProjectGuid = projectGuid });
project
- The project to save to Project Server\Project Online instance.saveOptions
- Instance of ProjectServerSaveOptions
class.
ProjectOnlineException
- In case of communication error or error returned by a server.Exception
Copyright (c) 2008-2020 Aspose Pty Ltd. All Rights Reserved.