Update Project Online Introduction
This example explains how to update existing 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}
PUT
Updates existing project in Project Server\Project Online instance. The existing project will be overwritten.
UpdateProject
cURL Example
Case 1: Update existing project online using login and password credentials
Case 2: Update existing project online using token credentials
SDKs
The Aspose.Tasks Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
Case 1: Update existing 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.UpdateProjectAsync(new UpdateProjectRequest()
{
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 = "UpdateProject.mpp";
$folder = $this->uploadFile("NewProductDev.mpp", $remoteName, '');
$response = $this->tasks->updateProject(new UpdateProjectRequest
($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)
put_request = UpdateProjectRequest(filename, 'http://project_server_instance.local/sites/pwa')
put_request.user_name = 'SomeUserName'
put_request.x_sharepoint_password = 'SomePassword'
put_result = self.tasks_api.update_project(put_request)
self.assertIsNotNone(put_result)
self.assertIsInstance(put_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 UpdateProjectRequest();
request.name = fileName
request.userName = "SomeLogin";
request.xSharepointPassword = "SomePassword";
request.siteUrl = "http://project_server_instance.local/sites/pwa";
const result = await tasksApi.updateProject(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.UpdateProjectOpts{
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.UpdateProject(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);
UpdateProjectRequest request = new UpdateProjectRequest(remoteFileName,"http://project_server_instance.local/sites/pwa", "SomeLogin", null, null, null, null, "SomePassword");
AsposeResponse result = TestInitializer.tasksApi.updateProject(request);
assertNotNull(result);
assertEquals(200, result.getCode().intValue());
Case 2: Update existing 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.UpdateProjectAsync(new UpdateProjectRequest()
{
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 = "UpdateProject.mpp";
$folder = $this->uploadFile("NewProductDev.mpp", $remoteName, '');
$response = $this->tasks->updateProject(new UpdateProjectRequest
($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)
put_request = UpdateProjectRequest(filename, 'http://project_server_instance.local/sites/pwa')
put_request.x_project_online_token = 'SOMESECRETTOKEN'
put_result = self.tasks_api.update_project(put_request)
self.assertIsNotNone(put_result)
self.assertIsInstance(put_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 UpdateProjectRequest();
request.name = fileName
request.xProjectOnlineToken = "SOMESECRETTOKEN";
request.siteUrl = "http://project_server_instance.local/sites/pwa";
const result = await tasksApi.updateProject(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.UpdateProjectOpts{
Name: remoteFileName,
SiteUrl: "http://project_server_instance.local/sites/pwa",
XProjectOnlineToken: optional.NewString("SOMESECRETTOKEN"),
Folder: optional.NewString(remoteBaseTestDataFolder),
}
result, _, err := client.TasksApi.UpdateProject(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);
UpdateProjectRequest request = new UpdateProjectRequest(remoteFileName, "http://project_server_instance.local/sites/pwa", null, null, null, null, "SOMESECRETTOKEN", null);
AsposeResponse result = TestInitializer.tasksApi.updateProject(request);
assertNotNull(result);
assertEquals(200, result.getCode().intValue());