Робота з проектом в Інтернеті
Contents
[
Hide
Show
]Клас ProjectServerManager надає методи отримання проектів із зазначеного онлайн -облікового запису проекту. Клас ProjectServercredentials повинен використовуватися для надання облікових даних, які використовуються для підключення до проекту в Інтернеті. Раніше Microsoft.sharepoint.client.runtime Assemble був використаний для отримання Authtoken, але тепер Aspose.Tasks надає можливість вказати ім’я сайту, користувача та пароль, щоб створити з’єднання з проектом в Інтернеті.
Прочитайте проект з проекту онлайн
Наступні рядки коду демонструють, як читати проект в Інтернеті.
1System::String sharepointDomainAddress = u"https://contoso.sharepoint.com";
2System::String userName = u"admin@contoso.onmicrosoft.com";
3System::String password = u"MyPassword";
4
5System::SharedPtr<ProjectServerCredentials> credentials = System::MakeObject<ProjectServerCredentials>(sharepointDomainAddress, userName, password);
6
7System::SharedPtr<ProjectServerManager> manager = System::MakeObject<ProjectServerManager>(credentials);
8System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<ProjectInfo>>> list = manager->GetProjectList();
9
10for (const auto& p : System::IterateOver(list))
11{
12 System::Console::WriteLine(u"Name : " + p->get_Name());
13 System::Console::WriteLine(u"CreatedDate : " + p->get_CreatedDate().ToString());
14 System::Console::WriteLine(u"Name : " + p->get_LastSavedDate().ToString());
15
16}
Create a Project Online
The following lines of code demonstrate how to create a project online.
1System::String sharepointDomainAddress = u"https://contoso.sharepoint.com";
2System::String userName = u"admin@contoso.onmicrosoft.com";
3System::String password = u"MyPassword";
4
5System::SharedPtr<ProjectServerCredentials> credentials = System::MakeObject<ProjectServerCredentials>(sharepointDomainAddress, userName, password);
6
7System::SharedPtr<Project> project = System::MakeObject<Project>(u"sample.mpp");
8
9System::SharedPtr<ProjectServerManager> manager = System::MakeObject<ProjectServerManager>(credentials);
10manager->CreateNewProject(project);