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).
More...
#include <ProjectServerManager.h>
Inherits System::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).
◆ ProjectServerManager()
Aspose::Tasks::ProjectServerManager::ProjectServerManager |
( |
const System::SharedPtr< ProjectServerCredentials > & |
credentials | ) |
|
Initializes a new instance of the ProjectServerManager class.
- Parameters
-
credentials | Credentials used to connect to Project Online account. |
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(const System::SharedPtr< ProjectServerCredentials > &credentials)
Initializes a new instance of the ProjectServerManager class.
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");
◆ CreateNewProject() [1/2]
void Aspose::Tasks::ProjectServerManager::CreateNewProject |
( |
const System::SharedPtr< Project > & |
project | ) |
|
Creates new project in Project Server\Project Online instance using default save options.
- Parameters
-
project | The project to save to Project Server\Project Online instance. |
- Exceptions
-
ProjectOnlineException | In case of communication error or error returned by a server. |
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");
manager.CreateNewProject(project);
◆ CreateNewProject() [2/2]
void Aspose::Tasks::ProjectServerManager::CreateNewProject |
( |
const System::SharedPtr< Project > & |
project, |
|
|
const System::SharedPtr< ProjectServerSaveOptions > & |
saveOptions |
|
) |
| |
Creates new project in Project Server\Project Online instance using the specified save options.
- Parameters
-
- Exceptions
-
ProjectOnlineException | In case of communication error or error returned by a server. |
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");
manager.CreateNewProject(project, new ProjectServerSaveOptions
{
ProjectName = "My new project"
});
◆ GetProject()
System::SharedPtr<Project> Aspose::Tasks::ProjectServerManager::GetProject |
( |
System::Guid |
projectGuid | ) |
|
Gets the project with the specified guid from the Project Online account \ Project Server instance.
- Returns
- Instance of Project class which represents project read from Project Online \ Project Server.
- Parameters
-
projectGuid | The Guid of the project to read. |
◆ GetProjectList()
System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<ProjectInfo> > > Aspose::Tasks::ProjectServerManager::GetProjectList |
( |
| ) |
|
Gets the list of projects from 'Working' store of the current Project Online account \ Project Server instance.
- Returns
- An enumeration of projects in the current Project Online account \ Project Server instance.
◆ GetProjectRawData()
System::SharedPtr<System::IO::Stream> Aspose::Tasks::ProjectServerManager::GetProjectRawData |
( |
System::Guid |
projectGuid | ) |
|
Gets the project's binary data for troubleshooting purposes.
- Returns
- Stream containing raw project's data.
- Parameters
-
projectGuid | The Guid of the project to read. |
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");
var projectGuid = new Guid("e0294bfb-5657-45c8-9cc5-82169fb95d69");
using (var fileStream = File.OpenWrite(@"c:\debug.zip"))
{
using (var stream = manager.GetProjectRawData(projectGuid))
{
stream.CopyTo(fileStream);
}
}
◆ UpdateProject() [1/2]
void Aspose::Tasks::ProjectServerManager::UpdateProject |
( |
const System::SharedPtr< Project > & |
project | ) |
|
Updates existing project in Project Server\Project Online instance using default save options. The existing project will be overwritten.
- Parameters
-
project | The project to save to Project Server\Project Online instance. |
- Exceptions
-
ProjectOnlineException | In case of communication error or error returned by a server. |
Project's property 'project.Get(Prj.Guid)' should be a valid guid of a project which exists in Project Server account \ Project Online instance.
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");
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);
◆ UpdateProject() [2/2]
void Aspose::Tasks::ProjectServerManager::UpdateProject |
( |
const System::SharedPtr< Project > & |
project, |
|
|
const System::SharedPtr< ProjectServerSaveOptions > & |
saveOptions |
|
) |
| |
Updates existing project in Project Server\Project Online instance using the specified save options. The existing project will be overwritten.
- Parameters
-
- Exceptions
-
ProjectOnlineException | In case of communication error or error returned by a server. |
saveOptions.ProjectGuid should be set to a guid of a project which exists on Project Server\ Project Online instance.
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");
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
});
◆ ExecutingWebRequest
System::EventHandler<System::SharedPtr<WebRequestEventArgs> > Aspose::Tasks::ProjectServerManager::ExecutingWebRequest |
An event that is raised when the web request is sent to Project Server's web API.