Travailler avec Project Online
Contents
[
Hide
Show
]La classe ProjectServerManager fournit les méthodes pour récupérer des projets du compte en ligne du projet spécifié. La classe ProjectServerCredentials doit être utilisée pour fournir des informations d’identification utilisées pour se connecter à Project Online. Auparavant, Microsoft.SharePoint.Client.Runtime a été utilisé pour récupérer AuthToken, mais maintenant Aspose.Tasks offre une option pour spécifier SITEURL, Nom d’utilisateur et mot de passe afin de créer une connexion à Project Online.
Lire le projet du projet en ligne
Les lignes de code suivantes montrent comment lire un projet en ligne.
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);