ProjectOperationsDeleteProject Method |
Delete a project.
Namespace:
Cobra.WebService.ClientAPI.Application.Files
Assembly:
Cobra.WebService.ClientAPI (in Cobra.WebService.ClientAPI.dll) Version: 8.4.717.3176 (8.4.0717.3176)
Syntax public ServiceResult DeleteProject(
DeleteProjectServiceArguments deleteProjectServiceArguments
)
Parameters
- deleteProjectServiceArguments
- Type: Cobra.Model.WebServiceDeleteProjectServiceArguments
An instance of DeleteProjectServiceArguments class that contains the options to delete a project.
Return Value
Type:
ServiceResultThe result of deleting a project.
Exceptions Exception | Condition |
---|
InvalidOperationException | Thrown when state of the instance of the CobraServices that generated the current ProjectOperations is not in opened state. |
Examples
This example shows how to delete a work package.
using Cobra.WebService.ClientAPI;
using Cobra.WebService.ClientAPI.Client;
using Cobra.WebService.ClientAPI.Application.Files;
using Cobra.Model.WebService;
.
.
.
CobraServices cobraServices = new CobraServices();
cobraServices.ServiceIdentityData.Username = "SYSADMIN";
cobraServices.ServiceIdentityData.SecurePassword = new SecurePassword();
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('P');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('A');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('W');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('O');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('R');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('D');
cobraServices.ServiceIdentityData.DataSourceKey = "COBRA";
LoginResult loginResult = cobraServices.Login();
if (!loginResult.Success) {
Console.WriteLine("Login failed.");
return;
}
Console.WriteLine("Login Success.");
ProjectOperations projectOperations = cobraServices.CreateServiceOperations<ProjectOperations>();
DeleteProjectServiceArguments deleteProjectServiceArguments = projectOperations.CreateProjectOperationsServiceArguments<DeleteProjectServiceArguments>();
deleteProjectServiceArguments.Project = "Demo Advanced";
deleteProjectServiceArguments.DeleteCalendar = true;
Console.WriteLine("Deleting project...");
ServiceResult deleteProjectResult = projectOperations.DeleteProject(deleteProjectServiceArguments);
if (deleteProjectResult.Success) {
Console.WriteLine("Project deleted successfully.");
}
else {
Console.WriteLine("Project did not deleted successfully.");
}
cobraServices.Logout();
See Also