IProductionManagerCancelJobAsync Method

Relativity.Productions.API
Sets the cancel job for a production job given its job ref.

Namespace:  Relativity.Productions.Services
Assembly:  Relativity.Productions.Services.Interfaces (in Relativity.Productions.Services.Interfaces.dll) Version: 11.1.0.1 9c084404c128f715df772c7792aa49f21535523c
Syntax

Task<CancelJobResult> CancelJobAsync(
	ProductionJobRef jobRef
)

Parameters

jobRef
Type: Relativity.Productions.Services.Interfaces.DTOsProductionJobRef
An object representing the production job to be canceled.

Return Value

Type: TaskCancelJobResult
The results of cancel operation on a production job.
Examples

Cancel production with job ref example
using Relativity.Services.ServiceProxy;
using Relativity.Productions.Services;
using Relativity.Services.Exceptions;

public partial class Example
{
    public async Task CancelProductionWithJobRef_Example()
    {
        int workspaceId = 12345;         // Workspace Production exists in
        int productionId = 11111;         // Production's ArtifactID

        var userEmail = "user@test.com";  // User's login
        var password = "abc123456!";     // User's password

        var relativityServicesUri = "http://localhost/relativity.services";
        var relativityRestUri = "http://localhost/relativity.rest/api";

        var usernamePasswordCredentials = new UsernamePasswordCredentials(userEmail, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);

        using (IProductionManager productionManager = serviceFactory.CreateProxy<IProductionManager>())
        {
            try
            {
                ProductionJobRef jobRef = new ProductionJobRef()
                {
                    WorkspaceID = workspaceId,
                    ProductionID = productionId
                };

                await productionManager.CancelJobAsync(jobRef);
            }
            catch (ValidationException e)
            {
                // Log validation exception details
                Console.WriteLine("There were validation errors: {0}", e.Message);
            }
            catch (ServiceException es)
            {
                // Log service exception details
                Console.WriteLine("There were errors: {0}", es.Message);
            }
        }
    }
}
See Also

Reference