Class ProjectServerManager

Class ProjectServerManager

Tên không gian: Aspose.Tasks Tổng hợp: Aspose.Tasks.dll (25.4.0)

Các lớp học cung cấp các phương pháp để đọc và thực hiện các hoạt động trên các dự án trong tài khoản Project Online cụ thể hoặctrong ví dụ Project Server được chỉ định ngay lập tức (được hỗ trợ các phiên bản Project Server 2016 và 2019).

public sealed class ProjectServerManager

Inheritance

object ProjectServerManager

Thành viên thừa kế

object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

ProjectServerManager(ProjectServerCredentials)

Bắt đầu một trường hợp mới của lớp Aspose.Tasks.ProjectServerManager.

public ProjectServerManager(ProjectServerCredentials credentials)

Parameters

credentials ProjectServerCredentials

Chứng nhận được sử dụng để kết nối với tài khoản Project Online.

Examples

Ví dụ này cho thấy làm thế nào để tạo một ví dụ của ProjectServerManager để truy cập vào ví dụ trước của Project Server.

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);

Ví dụ này cho thấy cách tạo ví dụ về ProjectServerManager để truy cập tài khoản trong dịch vụ Project Online.

var credentials = new ProjectServerCredentials("https://xxxxxx.sharepoint.com", "yyyyy@xxxxxxx.onmicrosoft.com", "password");
ProjectServerManager manager = new ProjectServerManager(projectServerCredentials);

Methods

CreateNewProject(Project)

Tạo dự án mới trong ví dụ Project Server\Project Online bằng cách sử dụng tùy chọn lưu mặc định.

public void CreateNewProject(Project project)

Parameters

project Project

Dự án để lưu vào Project Server\Project Online ví dụ.

Examples

Trong ví dụ này, dự án được tải từ tệp .mpp và được lưu vào tài khoản Project Online.

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);

Exceptions

ProjectOnlineException

Trong trường hợp lỗi giao tiếp hoặc lỗi trả về bởi một máy chủ.

CreateNewProject(Dự án, ProjectServerSaveOptions)

Tạo dự án mới trong ví dụ Project Server\Project Online bằng cách sử dụng các tùy chọn lưu được chỉ định.

public void CreateNewProject(Project project, ProjectServerSaveOptions saveOptions)

Parameters

project Project

Dự án để lưu vào Project Server\Project Online ví dụ.

saveOptions ProjectServerSaveOptions

Lớp Aspose.Tasks.ProjectServerSaveOptions

Examples

Trong ví dụ này, dự án được tải từ tệp .mpp và được lưu vào tài khoản Project Online.

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"
});

Exceptions

ProjectOnlineException

Trong trường hợp lỗi giao tiếp hoặc lỗi trả về bởi một máy chủ.

GetProject(Guid)

Nhận dự án với hướng dẫn được chỉ định từ tài khoản Project Online \ Project Server.

public Project GetProject(Guid projectGuid)

Parameters

projectGuid Guid

Hướng dẫn của dự án để đọc.

Returns

Project

Ví dụ về lớp Aspose.Tasks.Project mà đại diện cho dự án đọc từ Project Online \ Project Server.

GetProjectList()

Nhận danh sách các dự án từ cửa hàng Working của tài khoản Project Online hiện tại \ Project Server ví dụ.

public IEnumerable<projectinfo> GetProjectList()

Returns

IEnumerable < ProjectInfo >

Một danh sách các dự án trong tài khoản Project Online hiện tại \ Project Server.

GetProjectRawData(Guid)

Nhận dữ liệu nhị phân của dự án cho các mục đích giải quyết vấn đề.

public Stream GetProjectRawData(Guid projectGuid)

Parameters

projectGuid Guid

Hướng dẫn của dự án để đọc.

Returns

Stream

Stream chứa dữ liệu của dự án thô.

Examples

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);
    }
}

UpdateProject(Project)

Cập nhật dự án hiện có trong ví dụ Project Server\Project Online bằng cách sử dụng tùy chọn lưu mặc định.

public void UpdateProject(Project project)

Parameters

project Project

Dự án để lưu vào Project Server\Project Online ví dụ.

Examples

Trong ví dụ này, dự án được tải từ tài khoản Project Online, sửa đổi và lưu lại tài khoản Project Online.

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);

Remarks

Tài sản của dự án ‘project.Get(Prj.Guid)’ nên là một hướng dẫn hợp lệ cho một dự án có trong tài khoản Project Server \ Project Online ví dụ.

Exceptions

ProjectOnlineException

Trong trường hợp lỗi giao tiếp hoặc lỗi trả về bởi một máy chủ.

UpdateProject(Dự án, ProjectServerSaveOptions)

Cập nhật dự án hiện có trong ví dụ Project Server\Project Online bằng cách sử dụng các tùy chọn lưu được chỉ định.

public void UpdateProject(Project project, ProjectServerSaveOptions saveOptions)

Parameters

project Project

Dự án để lưu vào Project Server\Project Online ví dụ.

saveOptions ProjectServerSaveOptions

Lớp Aspose.Tasks.ProjectServerSaveOptions

Examples

Trong ví dụ này, dự án được tải từ tài khoản Project Online, sửa đổi và lưu lại tài khoản Project Online.

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
});

Remarks

saveOptions.ProjectGuid nên được thiết lập để hướng dẫn một dự án có sẵn trên ví dụ Project Server\ Project Online.

Exceptions

ProjectOnlineException

Trong trường hợp lỗi giao tiếp hoặc lỗi trả về bởi một máy chủ.

ExecutingWebRequest

Một sự kiện được phát sinh khi yêu cầu web được gửi đến API web của Project Server.

public event EventHandler<webrequesteventargs> ExecutingWebRequest

Sự kiện Type

EventHandler < WebRequestEventArgs >

 Tiếng Việt