IProductionDataSourceManagerCreateSingleAsync Method

Creates a production datasource in the workspace.

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

Task<int> CreateSingleAsync(
	int workspaceArtifactID,
	int productionID,
	ProductionDataSource dataSource


Type: SystemInt32
Workspace artifact ID.
Type: SystemInt32
Production artifact ID.
Type: Relativity.Productions.ServicesProductionDataSource
ProductionDataSource object.

Return Value

Type: TaskInt32
ArtifactID of the new ProductionDataSource.

Create DataSource Example
using Relativity.Productions.Services;
using Relativity.Services.Search;
using Relativity.Services.ServiceProxy;
using Relativity.Services.Exceptions;

public partial class Example
    public async Task CreateDataSource_Example()
        var workspaceID   = 11111;            // ArtifactID of Workspace where Data source will be saved
        var productionID  = 22222;            // ArtifactID of Production to add the new data source to
        var placeholderID = 33333;            // ArtifactID of Placeholder to use with this data source
        var savedSearchID = 44444;            // ArtifactID of Saved Search containing documents for this data source
        var markupSetID   = 55555;            // ArtifactID of Markup Set to use for burning redactions
        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 (IProductionDataSourceManager productionDataSourceManager = serviceFactory.CreateProxy<IProductionDataSourceManager>())
                ProductionDataSource dataSource = new ProductionDataSource()
                    Name                = "Excel Sheets",
                    SavedSearch         = new SavedSearchRef(savedSearchID),
                    ProductionType      = ProductionType.ImagesAndNatives,
                    UseImagePlaceholder = UseImagePlaceholderOption.WhenNoImageExists,
                    Placeholder         = new ProductionPlaceholderRef(placeholderID),
                    BurnRedactions      = true,
                    MarkupSet           = new MarkupSetRef(markupSetID)
                await productionDataSourceManager.CreateSingleAsync(workspaceID, productionID, dataSource);

            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