オンラインでプロジェクトで作業します
Contents
[
Hide
Show
]ProjectserverManagerクラスは、指定されたプロジェクトオンラインアカウントからプロジェクトを取得する方法を提供します。 ProjectServerCredentialsクラスは、オンラインプロジェクトに接続するために使用される資格情報を提供するために使用するものとします。以前は、Microsoft.SharePoint.Client.Runtimeアセンブリを使用してAuthTokenを取得しましたが、Aspose.Tasksは、Project Onlineへの接続を作成するためにSiteURL、ユーザー名、およびパスワードを指定するオプションを提供します。
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<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);