IProductionManagerCreateSingleAsync Method

Relativity.Productions.API
Creates a production in the workspace.

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

Task<int> CreateSingleAsync(
	int workspaceArtifactID,
	Production production
)

Parameters

workspaceArtifactID
Type: SystemInt32
Workspace artifact ID.
production
Type: Relativity.Productions.ServicesProduction
An instance of Production object representing the production to be created.

Return Value

Type: TaskInt32
Artifact ID of new production.
Examples

Create Production with Pagel Level Numbering example
using Relativity.Productions.Services;
using Relativity.Services.ServiceProxy;
using Relativity.Services.Exceptions;

public partial class Example
{
    public async Task CreatePageLevelProduction_Example()
    {
        int workspaceId  = 12345;                   // ArtifactID of Workspace where Production will be saved
        var userName     = "user@test.com";         // User's login
        var userPassword = "abc123456!";            // User's password

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

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

        using (IProductionManager productionManager = serviceFactory.CreateProxy<IProductionManager>())
        {
            try
            {
                // Construct the production object that you want to create
                var production = new Production
                {
                    Name = "Page Level Production Sample",
                    Details = new ProductionDetails
                    {
                        DateProduced      = new DateTime(2017, 10, 22),
                        EmailRecipients   = "pagelevelnumber@relativity.com; emosewa@gmail.com",
                        ScaleBrandingFont = true,
                        BrandingFontSize  = 25,
                        PlaceholderImageFormat = PlaceholderImageFormat.Tiff
                    },

                    Numbering = new PageLevelNumbering
                    {
                        BatesPrefix                        = "ADBE",
                        BatesSuffix                        = "DRAFT",
                        BatesStartNumber                   = 20,
                        NumberOfDigitsForDocumentNumbering = 5
                    },

                    Footers = new ProductionFooters
                    {
                        LeftFooter = new HeaderFooter("Left Footer")
                        {
                            Type     = HeaderFooterType.FreeText,
                            FreeText = "This is confidential page"
                        }
                    },

                    SortOrder = new List<Sort>()
                    {
                        new Sort()
                        {
                            Direction = SortEnum.Ascending,
                            FieldIdentifier = new FieldRef("First Sort Field"),
                            Order = 0
                        },
                        new Sort()
                        {
                            Direction = SortEnum.Descending,
                            FieldIdentifier = new FieldRef("Second Sort Field"),
                            Order = 1
                        }
                    },

                    Keywords = "PageLevel, Complete Setting",
                    Notes    = "Page level numbering production"
                };

                // Save the production into the specified workspace
                int productionId = await productionManager.CreateSingleAsync(workspaceId, production);

                Console.WriteLine("The created production Id is {0}", productionId);
            }
            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);
            }
        }
    }
}
Create ExistingProductionNumbering Production example
using Relativity.Productions.Services;
using Relativity.Services.ServiceProxy;
using Relativity.Services.Exceptions;

public partial class Example
{
    public async Task CreateExistingProductionNumberingProduction_Example()
    {
        int workspaceId          = 12345;                   // ArtifactID of Workspace where Production will be saved
        int existingProductionId = 234567;                  // ArtifactID of A Produced Production which can be used as an existing Production in create
        var userName             = "user@test.com";         // User's login
        var userPassword         = "abc123456!";            // User's password

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

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

        using (IProductionManager productionManager = serviceFactory.CreateProxy<IProductionManager>())
        {
            try
            {
                var production = new Production
                {
                    Name = "Sample Production - Default Settings",
                    Numbering = new ExistingProductionNumbering()
                    {
                        ExistingProduction = new ProductionRef(existingProductionId)
                    }

                };
                // Save the production into the specified workspace
                int productionId = await productionManager.CreateSingleAsync(workspaceId, production);    

                Console.WriteLine("The created production Id is {0}", productionId);
            }
            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