Delete a Task Link Introduction
This example allows you to delete a task link from Project 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/{name}/taskLinks
DELETE
Delete Task Link
DeleteTaskLink
cURL Example
SDKs
The Aspose.Tasks Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
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 deleteResponse = await TasksApi.DeleteTaskLinkAsync(new DeleteTaskLinkRequest()
{
Index = 1,
Name = remoteName,
Folder = this.DataFolder
});
Assert.AreEqual((int)HttpStatusCode.OK, deleteResponse.Code);
var linksResponse = await TasksApi.GetTaskLinksAsync(new GetTaskLinksRequest()
{
Name = remoteName,
Folder = this.DataFolder
});
Assert.AreEqual((int)HttpStatusCode.OK, linksResponse.Code);
Assert.IsNotNull(linksResponse.TaskLinks);
Assert.AreEqual(23, linksResponse.TaskLinks.Count);
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/
$remoteName = "DeleteTaskLink.mpp";
$folder = $this->uploadFile("NewProductDev.mpp", $remoteName, '');
$response = $this->tasks->deleteTaskLink(new Requests\DeleteTaskLinkRequest($remoteName, 1, self::$storageName, $folder, null));
Assert::assertEquals(200, $response->getCode());
$response = $this->tasks->getTaskLinks(new Requests\GetTaskLinksRequest($remoteName, self::$storageName, $folder, null));
Assert::assertEquals(200, $response->getCode());
Assert::assertNotNull($response->getTaskLinks());
Assert::assertEquals(23, count($response->getTaskLinks()));
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)
delete_request = DeleteTaskLinkRequest(filename, 1)
delete_result = self.tasks_api.delete_task_link(delete_request)
self.assertIsNotNone(delete_result)
self.assertIsInstance(delete_result, AsposeResponse)
get_request = GetTaskLinksRequest(filename)
get_result = self.tasks_api.get_task_links(get_request)
self.assertIsInstance(get_result, TaskLinksResponse)
self.assertIsNotNone(get_result.task_links)
self.assertEqual(23, len(get_result.task_links))
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;
const remotePath = "Temp/Data";
const remoteFullPath = remotePath + "/" + fileName;
await tasksApi.uploadFileToStorage(remoteFullPath, localPath);
const deleteRequest = new DeleteTaskLinkRequest();
deleteRequest.name = fileName;
deleteRequest.folder = remotePath;
deleteRequest.index = 1;
const deleteResult = await tasksApi.deleteTaskLink(deleteRequest);
expect(deleteResult.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)
deleteOpts := &requests.DeleteTaskLinkOpts{
Index: 1,
Name: remoteFileName,
Folder: optional.NewString(remoteBaseTestDataFolder),
}
deleteResult, _, err := client.TasksApi.DeleteTaskLink(ctx, deleteOpts)
if err != nil {
t.Error(err)
}
assert.Equal(t, int32(200), deleteResult.Code)
getResult, _, err := client.TasksApi.GetTaskLinks(ctx, &requests.GetTaskLinksOpts{
Name: remoteFileName,
Folder: optional.NewString(remoteBaseTestDataFolder),
})
if err != nil {
t.Error(err)
}
assert.Equal(t, int32(200), getResult.Code)
assert.Equal(t, 23, len(getResult.TaskLinks))
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);
DeleteTaskLinkRequest request1 = new DeleteTaskLinkRequest(remoteFileName, 1, null, null, null);
AsposeResponse result1 = TestInitializer.tasksApi.deleteTaskLink(request1);
assertNotNull(result1);
assertEquals(Integer.valueOf(200), result1.getCode());
GetTaskLinksRequest request2 = new GetTaskLinksRequest(remoteFileName, null, null);
TaskLinksResponse result2 = TestInitializer.tasksApi.getTaskLinks(request2);
assertNotNull(result2);
assertEquals(Integer.valueOf(200), result2.getCode());
assertNotNull(result2.getTaskLinks());
assertEquals(23, result2.getTaskLinks().size());