Delete Calendar Exception Introduction
This example allows you to delete calendar exception from calendar exceptions collection, using Aspose.Tasks Cloud. Aspose.Tasks Cloud is a REST API which can be used with any language: .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more.
API
Type
Description
Resource Link
/tasks/{name}/calendars/{calendarUid}/calendarExceptions/{index}
DELETE
Delete a calendar Exception
DeleteCalendarException
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("Calenar with exception.mpp");
var response = await TasksApi.DeleteCalendarExceptionAsync(new DeleteCalendarExceptionRequest
{
Name = remoteName,
Folder = this.DataFolder,
CalendarUid = 1,
Index = 1
});
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/
$remoteName = "DeleteCalendarException.mpp";
$folder = $this->uploadFile("Calenar with exception.mpp", $remoteName, '');
$response = $this->tasks->deleteCalendarException(new Requests\DeleteCalendarExceptionRequest($remoteName, 1, 1, null, self::$storageName, $folder));
Assert::assertEquals(200, $response->getCode());
$response = $this->tasks->getCalendarExceptions(new Requests\GetCalendarExceptionsRequest($remoteName, 1, self::$storageName, $folder));
Assert::assertEquals(200, $response->getCode());
Assert::assertNotNull($response->getCalendarExceptions());
Assert::assertEquals(0, count($response->getCalendarExceptions()));
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 = 'Calenar_with_exception.mpp'
self.upload_file(filename)
delete_request = DeleteCalendarExceptionRequest(filename, 1, 1)
delete_result = self.tasks_api.delete_calendar_exception(delete_request)
self.assertIsNotNone(delete_result)
self.assertIsInstance(delete_result, AsposeResponse)
get_request = GetCalendarExceptionsRequest(filename, 1)
get_result = self.tasks_api.get_calendar_exceptions(get_request)
self.assertIsNotNone(get_result)
self.assertIsInstance(get_result, CalendarExceptionsResponse)
self.assertEqual(0, len(get_result.calendar_exceptions))
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 = "Calenar_with_exception.mpp";
const localPath = "./Data/" + fileName;
const remotePath = "Temp/Data";
const remoteFullPath = remotePath + "/" + fileName;
await tasksApi.uploadFileToStorage(remoteFullPath, localPath);
const request = new DeleteCalendarExceptionRequest();
request.name = fileName;
request.folder = remotePath;
request.calendarUid = 1;
request.index = 1
const result = await tasksApi.deleteCalendarException(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)
deleteResult, _, err := client.TasksApi.DeleteCalendarException(ctx, &requests.DeleteCalendarExceptionOpts{
CalendarUid: 1,
Index: 1,
Name: remoteFileName,
Folder: optional.NewString(remoteBaseTestDataFolder),
})
if err != nil {
t.Error(err)
}
assert.Equal(t, int32(200), deleteResult.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 = "Calenar_with_exception.mpp";
String remoteFileName = TestInitializer.UploadFile(localFileName);
DeleteCalendarExceptionRequest request1 = new DeleteCalendarExceptionRequest(remoteFileName, 1, 1, null, null,null);
AsposeResponse result1 = TestInitializer.tasksApi.deleteCalendarException(request1);
assertEquals(200, (int) result1.getCode());
GetCalendarExceptionsRequest request2 = new GetCalendarExceptionsRequest(remoteFileName, 1,null, null);
CalendarExceptionsResponse result2 = TestInitializer.tasksApi.getCalendarExceptions(request2);
assertNotNull(result2);
assertEquals(200, (int) result2.getCode());
assertNotNull(result2.getCalendarExceptions());
assertEquals(0, result2.getCalendarExceptions().size());