Introduction

OpenText is a leading enterprise information management (EIM) platform used across industries to manage content, automate business processes, and ensure regulatory compliance. Whether it’s managing scanned documents, automating document workflows, or enforcing compliance with document retention policies, OpenText plays a vital role.

In this blog post, we’ll explore the most common OpenText use cases customers ask for — and show you how to tackle them with .NET 9 and C#.


🔍 Use Case 1: Document Upload with Metadata

Scenario: A user uploads a scanned invoice that should be stored in OpenText Content Server with relevant metadata (e.g., Vendor, Invoice Number, Date).

✅ .NET 9 Code: Uploading a Document with Metadata

using System.Net.Http.Headers;

var client = new HttpClient();
client.BaseAddress = new Uri("https://opentext.example.com/otcs/cs/api/v1/");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "<access_token>");

var metadata = new
{
    name = "Invoice_2025_123.pdf",
    parent_id = 2000,
    type = 144, // 144 = Document
    metadata = new
    {
        Vendor = "Acme Inc.",
        InvoiceNumber = "123",
        InvoiceDate = "2025-05-30"
    }
};

using var form = new MultipartFormDataContent();
form.Add(new StringContent(JsonSerializer.Serialize(metadata)), "metadata");
form.Add(new StreamContent(File.OpenRead("Invoice_2025_123.pdf")), "file", "Invoice_2025_123.pdf");

var response = await client.PostAsync("nodes", form);
Console.WriteLine(await response.Content.ReadAsStringAsync());

📄 Use Case 2: Searching for Documents by Metadata

Scenario: Users need to search all documents where InvoiceNumber = 123.

✅ .NET 9 Code: Metadata Search Query

var searchQuery = new
{
    query = new
    {
        where = new[]
        {
            new
            {
                property = "InvoiceNumber",
                operator_ = "=",
                value = "123"
            }
        }
    }
};

var json = JsonSerializer.Serialize(searchQuery);
var response = await client.PostAsync("search", new StringContent(json, Encoding.UTF8, "application/json"));
var results = await response.Content.ReadAsStringAsync();
Console.WriteLine(results);

🔁 Use Case 3: Workflow Integration – Starting a Workflow on Upload

Scenario: After uploading an invoice, trigger an approval workflow.

✅ .NET 9 Code: Triggering a Workflow

var workflowStart = new
{
    workflow_map_id = 10123, // ID of the predefined workflow map
    attachments = new[]
    {
        new { id = 123456, type = 144 } // ID of uploaded document
    }
};

var json = JsonSerializer.Serialize(workflowStart);
var response = await client.PostAsync("workflows", new StringContent(json, Encoding.UTF8, "application/json"));
Console.WriteLine(await response.Content.ReadAsStringAsync());

🔐 Use Case 4: Setting Permissions (ACLs) on a Document

Scenario: Grant read-only access to a document for a specific user group.

✅ .NET 9 Code: Setting ACL

var acl = new
{
    permissions = new[]
    {
        new
        {
            permissions = 1, // Read
            right_id = 4000, // Group ID
            type = "group"
        }
    }
};

var json = JsonSerializer.Serialize(acl);
var response = await client.PutAsync("nodes/123456/permissions", new StringContent(json, Encoding.UTF8, "application/json"));
Console.WriteLine(await response.Content.ReadAsStringAsync());

🗑️ Use Case 5: Document Retention and Auto-Deletion

Scenario: Mark a document for deletion 7 years after creation.

This typically involves assigning a lifecycle policy via Records Management or applying custom attributes.

✅ .NET 9 Code: Assigning a Category with Retention Policy

var category = new
{
    categories = new[]
    {
        new
        {
            category_id = 6001, // Retention policy category
            attributes = new
            {
                RetainUntil = DateTime.UtcNow.AddYears(7).ToString("yyyy-MM-dd")
            }
        }
    }
};

var json = JsonSerializer.Serialize(category);
var response = await client.PutAsync("nodes/123456/categories", new StringContent(json, Encoding.UTF8, "application/json"));
Console.WriteLine(await response.Content.ReadAsStringAsync());

📁 Use Case 6: Folder and Hierarchical Document Organization

Scenario: Create a structured folder (e.g., /2025/Invoices/) before uploading.

✅ .NET 9 Code: Create Folder Hierarchy

var folder = new
{
    name = "2025",
    parent_id = 2000,
    type = 0 // 0 = Folder
};

var json = JsonSerializer.Serialize(folder);
var response = await client.PostAsync("nodes", new StringContent(json, Encoding.UTF8, "application/json"));
var folderId = JsonDocument.Parse(await response.Content.ReadAsStringAsync())
                           .RootElement.GetProperty("data").GetProperty("id").GetInt32();

// Now create "Invoices" subfolder
var invoicesFolder = new
{
    name = "Invoices",
    parent_id = folderId,
    type = 0
};

var response2 = await client.PostAsync("nodes", new StringContent(JsonSerializer.Serialize(invoicesFolder), Encoding.UTF8, "application/json"));
Console.WriteLine(await response2.Content.ReadAsStringAsync());

📦 Use Case 7: Downloading Documents

Scenario: User requests to download a document by its ID.

✅ .NET 9 Code: Document Download

var response = await client.GetAsync("nodes/123456/content");
response.EnsureSuccessStatusCode();

await using var stream = await response.Content.ReadAsStreamAsync();
await using var fileStream = File.Create("DownloadedInvoice.pdf");
await stream.CopyToAsync(fileStream);

Console.WriteLine("File downloaded!");

🧠 Summary: Why OpenText and .NET 9 Make a Powerful Combo

Use CaseValue for Customer
Document UploadCentral for digital archives and process automation
Metadata SearchEnables fast retrieval and compliance
Workflow AutomationSpeeds up approval cycles and enhances productivity
ACL ManagementSecures sensitive information based on roles
Retention PoliciesAssures legal compliance and reduces data sprawl
Structured FoldersMaintains orderly storage aligned with business rules
Document DownloadEnsures external access and backup

.NET 9, with its modern HTTP APIs, records, and performance optimizations, is an ideal platform to build secure and high-performing enterprise applications around OpenText.


🔔 Next Steps:

  • Implement logging and telemetry for audit-compliant actions.
  • Add retry logic with Polly for resiliency.
  • Consider wrapping these actions into reusable services or middleware.

Views: 6

🚀 Real-World OpenText Use Cases with .NET 9: Code-Centric Guide

Johannes Rest


.NET Architekt und Entwickler


Beitragsnavigation


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert