IProductionDataSourceManagerUpdateSingleAsync Method

Relativity.Productions.API
Updates a production datasource 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 UpdateSingleAsync(
	int workspaceArtifactID,
	int productionID,
	ProductionDataSource dataSource
)

Parameters

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

Return Value

Type: Task
Examples

Update 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 UpdateDataSource_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 dataSourceID  = 33333;            // ArtifactID of DataSource to update
        var savedSearchID = 44444;            // ArtifactID of Saved Search containing documents for this data source
        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>())
        {
            try
            {
                // Read in DataSource that you would like to update
                ProductionDataSource productionDataSource = await productionDataSourceManager.ReadSingleAsync(workspaceID, dataSourceID);

                // Change DataSource properties to desired updated values
                productionDataSource.Name        = "Updated datasource name";
                productionDataSource.SavedSearch = new SavedSearchRef(savedSearchID);
                await productionDataSourceManager.UpdateSingleAsync(workspaceID, productionID, productionDataSource);

            }
            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