IProductionPlaceholderManagerUpdateSingleAsync Method

Relativity.Productions.API
Updates a placeholder 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,
	ProductionPlaceholder placeholder
)

Parameters

workspaceArtifactID
Type: SystemInt32
Workspace artifact ID.
placeholder
Type: Relativity.Productions.ServicesProductionPlaceholder
An instance of ProductionPlaceholder object with updated values.

Return Value

Type: Task
Remarks

If PlaceholderType is Custom, then the CustomText must be specified. It is possible to create a blank placeholder using a CustomText with an empty string.

If PlaceholderType is Image, then the FileData and Filename properties must be specified.

Examples

Update Image Placeholder Example
using Relativity.Productions.Services;
using Relativity.Services.ServiceProxy;
using Relativity.Services.Exceptions;

public partial class Example
{
    public async Task UpdateImagePlaceholder_Example()
    {
        var workspaceID   = 11111;            // ArtifactID of Workspace where Placeholder exists
        int placeholderID = 33333;            // ArtifactID of Image Placeholder to update
        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);

        string fileLocation = @"\\servername\share\Placeholder.jpg";
        string filename     = Path.GetFileName(fileLocation);
        byte[] fileData     = ReadFully(fileLocation);

        using (IProductionPlaceholderManager productionPlaceholderManager = serviceFactory.CreateProxy<IProductionPlaceholderManager>())
        {
            try
            {
                // Read the placeholder you would like to update, so we get the fully filled object
                ProductionPlaceholder placeholder = await productionPlaceholderManager.ReadSingleAsync(workspaceID, placeholderID);

                // Update the placeholder (change the name, change uploaded image)
                fileLocation = @"\\servername\share\ReplacementPlaceholder.jpg";
                filename     = Path.GetFileName(fileLocation);
                fileData     = ReadFully(fileLocation);

                placeholder.Name     = "Placeholder for excel sheets - No redactions";
                placeholder.Filename = filename;
                placeholder.FileData = fileData;
                await productionPlaceholderManager.UpdateSingleAsync(workspaceID, placeholder);

            }
            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);
            }
        }
    }
}
Update Custom Placeholder Example
using Relativity.Productions.Services;
using Relativity.Services.ServiceProxy;
using Relativity.Services.Exceptions;

public partial class Example
{
    public async Task UpdateCustomPlaceholder_Example()
    {
        var workspaceID   = 11111;               // ArtifactID of Workspace where Placeholder exists
        int placeholderID = 22222;               // ArtifactID of Custom Placeholder to update
        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 (IProductionPlaceholderManager productionPlaceholderManager = serviceFactory.CreateProxy<IProductionPlaceholderManager>())
        {
            try
            {
                // Read the placeholder you would like to update, so we get the fully filled object
                ProductionPlaceholder placeholder = await productionPlaceholderManager.ReadSingleAsync(workspaceID, placeholderID);

                // Update the placeholder (change the name, change the custom text)
                placeholder.Name       = "Placeholder for excel sheets - No redactions";
                placeholder.CustomText = "<P><B>This is an excel sheet for document: [Control Number].</B></P>";
                await productionPlaceholderManager.UpdateSingleAsync(workspaceID, placeholder);

            }
            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