Create New Project Online Introduction
This example explains how to create new project online by providing Token or Login and Password credentials using Aspose.Tasks Cloud API in your applications. You can use our REST API with any language: .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more.
API
Type
Description
Resource Link
/tasks/projectOnline/{siteUrl}/{name}
POST
Creates new project in Project Server\Project Online instance
CreateNewProject
cURL Example
Case 1: Create new project online using login and password credentials
Case 2: Create new project online using token credentials
SDKs
The Aspose.Tasks Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
Case 1: Create new project online using login and password credentials
C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-dotnet/
var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp");
var response = await TasksApi.CreateNewProjectAsync(new CreateNewProjectRequest()
{
Name = remoteName,
UserName = "SomeLogin",
XSharepointPassword = "SomePassword",
SiteUrl = "http://project_server_instance.local/sites/pwa"
});
Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-php/
static::markTestSkipped('Ignored because real credentials for project server online is required');
$remoteName = "CreateNewProject.mpp";
$folder = $this->uploadFile("NewProductDev.mpp", $remoteName, '');
$response = $this->tasks->createNewProject(new CreateNewProjectRequest
($remoteName, 'http://project_server_instance.local/sites/pwa', null, $folder, self::$storageName, null, 'SomeLogin', 'SomePassword'));
Assert::assertEquals(200, $response->getCode());
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-python
filename = 'NewProductDev.mpp'
self.upload_file(filename)
post_request = CreateNewProjectRequest(filename, 'http://project_server_instance.local/sites/pwa')
post_request.user_name = 'SomeUserName'
post_request.x_sharepoint_password = 'SomePassword'
post_result = self.tasks_api.create_new_project(post_request)
self.assertIsNotNone(post_result)
self.assertIsInstance(post_result, AsposeResponse)
Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-node
const fileName = "NewProductDev.mpp";
const localPath = "./Data/" + fileName;
await tasksApi.uploadFileToStorage(fileName, localPath);
const request = new CreateNewProjectRequest();
request.name = fileName
request.userName = "SomeLogin";
request.xSharepointPassword = "SomePassword";
request.siteUrl = "http://project_server_instance.local/sites/pwa";
const result = await tasksApi.createNewProject(request);
expect(result.response.statusCode).to.equal(200);
Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-go/
client, ctx := UploadTestFileToStorage(t, localFileName, remoteBaseTestDataFolder+"/"+remoteFileName)
options := &requests.CreateNewProjectOpts{
Name: remoteFileName,
SiteUrl: "http://project_server_instance.local/sites/pwa",
UserName: optional.NewString("SomeLogin"),
XSharepointPassword: optional.NewString("SomePassword"),
Folder: optional.NewString(remoteBaseTestDataFolder),
}
result, _, err := client.TasksApi.CreateNewProject(ctx, options)
if err != nil {
t.Error(err)
}
assert.Equal(t, int32(200), result.Code)
Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-java/
String localFileName = "NewProductDev.mpp";
String remoteFileName = TestInitializer.UploadFile(localFileName);
CreateNewProjectRequest request = new CreateNewProjectRequest(remoteFileName,"http://project_server_instance.local/sites/pwa", "SomeLogin", null, null, null, null, "SomePassword");
AsposeResponse result = TestInitializer.tasksApi.createNewProject(request);
assertNotNull(result);
assertEquals(200, result.getCode().intValue());
Case 2: Create new project online using token credentials
C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-dotnet/
var remoteName = await UploadFileToStorageAsync("NewProductDev.mpp");
var response = await TasksApi.CreateNewProjectAsync(new CreateNewProjectRequest()
{
Name = remoteName,
XProjectOnlineToken = "SOMESECRETTOKEN",
SiteUrl = "http://project_server_instance.local/sites/pwa"
});
Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-php/
static::markTestSkipped('Ignored because real credentials for project server online is required');
$remoteName = "CreateNewProject.mpp";
$folder = $this->uploadFile("NewProductDev.mpp", $remoteName, '');
$response = $this->tasks->createNewProject(new CreateNewProjectRequest
($remoteName, 'http://project_server_instance.local/sites/pwa', null, $folder, self::$storageName, 'SOMESECRETTOKEN'));
Assert::assertEquals(200, $response->getCode());
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-python
filename = 'NewProductDev.mpp'
self.upload_file(filename)
post_request = CreateNewProjectRequest(filename, 'http://project_server_instance.local/sites/pwa')
post_request.x_project_online_token = 'SOMESECRETTOKEN'
post_result = self.tasks_api.create_new_project(post_request)
self.assertIsNotNone(post_result)
self.assertIsInstance(post_result, AsposeResponse)
Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-node
const fileName = "NewProductDev.mpp";
const localPath = "./Data/" + fileName;
await tasksApi.uploadFileToStorage(fileName, localPath);
const request = new CreateNewProjectRequest();
request.name = fileName
request.xProjectOnlineToken = "SOMESECRETTOKEN";
request.siteUrl = "http://project_server_instance.local/sites/pwa";
const result = await tasksApi.createNewProject(request);
expect(result.response.statusCode).to.equal(200);
Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-go/
client, ctx := UploadTestFileToStorage(t, localFileName, remoteBaseTestDataFolder+"/"+remoteFileName)
options := &requests.CreateNewProjectOpts{
Name: remoteFileName,
SiteUrl: "http://project_server_instance.local/sites/pwa",
XProjectOnlineToken: optional.NewString("SOMESECRETTOKEN"),
Folder: optional.NewString(remoteBaseTestDataFolder),
}
result, _, err := client.TasksApi.CreateNewProject(ctx, options)
if err != nil {
t.Error(err)
}
assert.Equal(t, int32(200), result.Code)
Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-java/
String localFileName = "NewProductDev.mpp";
String remoteFileName = TestInitializer.UploadFile(localFileName);
CreateNewProjectRequest request = new CreateNewProjectRequest(remoteFileName, "http://project_server_instance.local/sites/pwa", null, null, null, null, "SOMESECRETTOKEN", null);
AsposeResponse result = TestInitializer.tasksApi.createNewProject(request);
assertNotNull(result);
assertEquals(200, result.getCode().intValue());