New version of the .net wrapper

Recent updates improve document processing, database maintenance, agent administration, debugging, and standalone runtime diagnostics.

ComputeWithForm

Documents can be computed using a Domino form:

var success = document.ComputeWithForm(
    doDataTypes: false,
    raiseError: false);

Console.WriteLine($"Computed successfully: {success}");

Validation failures can be returned to the application:

var success = document.ComputeWithForm(
    doDataTypes: false,
    raiseError: false,
    out string[] failedFields);

foreach (var field in failedFields)
{
    Console.WriteLine($"Validation failed: {field}");
}

Detailed validation information is also available:

var success = document.ComputeWithForm(
    raiseError: false,
    out NotesComputeWithFormError[] errors);

foreach (var error in errors)
{
    Console.WriteLine(
        $"{error.FieldName}: {error.Message} ({error.ErrorCode})");
}

When raiseError is true, a failed validation raises a NotesException.

Database creation and design maintenance

Databases can be created directly through NotesDatabase:

using var database = session.GetDatabase(
    "",
    "data\\NewDatabase.nsf");

if (database.Create())
{
    Console.WriteLine("Database created.");
}
else
{
    Console.WriteLine("Database already exists.");
}

A database can also be created from a template:

using var template = session.GetDatabase("", "template.ntf");
using var database = template.CreateFromTemplate(
    "",
    "data\\NewApplication.nsf",
    inheritFlag: true);

Design refresh is supported as well:

database.RefreshDesign(
    templateServer: "",
    force: true,
    errorIfTemplateNotFound: true);

Full-text index management

Full-text indexes can be created, updated, and deleted:

database.CreateFTIndex(
    NotesFullTextIndexOptions.Attachments |
    NotesFullTextIndexOptions.StemIndex);

database.UpdateFTIndex();

database.DeleteFTIndex();

Options include attachments, binary attachments, encrypted fields, stemming, case sensitivity, summary-only indexing, optimization, and reindexing.

Local database transactions

Local database transactions can be controlled explicitly:

database.TransactionBegin();

try
{
    using var document = database.CreateDocument();
    document.ReplaceItemValue("Subject", "Transactional update");
    document.Save();

    database.TransactionCommit();
}
catch
{
    database.TransactionRollback();
    throw;
}

Named and profile documents

Named documents can be opened directly:

using var namedDocument =
    database.GetNamedDocument(
        "Configuration",
        session.UserName);

if (namedDocument is not null)
{
    Console.WriteLine($"Named document: {namedDocument.NoteID}");
}

A named document collection can also be retrieved:

using var documents =
    database.GetNamedDocumentCollection(
        "Configuration",
        session.UserName);

Console.WriteLine($"Documents found: {documents.Count}");

Profile document collections are supported through:

using var profiles =
    database.GetProfileDocCollection("ApplicationProfile");

Console.WriteLine($"Profiles found: {profiles.Count}");

Agent administration

Agent scheduling information is available through NotesAgent:

foreach (var agent in database.Agents)
{
    Console.WriteLine(
        $"{agent.Name}: " +
        $"Enabled={agent.IsEnabled}, " +
        $"Scheduled={agent.IsScheduled}");
}

Wrapper-specific convenience features

DotNetToDomino adds higher-level convenience methods that are not directly exposed as equivalent operations in the Domino C API.

For example, all scheduled agents can be retrieved in one call:

foreach (var agent in database.ScheduledAgents())
{
    Console.WriteLine(agent.Name);
}

All enabled agents can also be disabled and saved with one operation:

database.DisableAllAgents();

The mutable Schedule property provides a .NET-friendly representation of an agent schedule, including:

  • Interval and interval type
  • Start and end times
  • Start and end dates
  • Weekday settings
  • Monthly scheduling
  • Weekend handling

After modifying the schedule, save the agent:

var agent = database.GetAgent("Nightly Cleanup");

if (agent is not null)
{
    agent.Schedule.SkipWeekends = true;
    agent.Schedule.Interval = 2;
    agent.Save();
}

Debugger-friendly Notes objects

The wrapper provides debugger-friendly display values for Notes objects. Important values such as database title, file name, file path, session information, views, agents, and note IDs are easier to inspect in Visual Studio.

Closed NotesDatabase objects also avoid unnecessary property evaluation errors by returning safe values such as null, empty strings, or empty collections where appropriate.

Standalone Domino runtime diagnostics

Standalone applications can specify the Domino runtime, notes.ini, and ID password explicitly:

using var session = new NotesSession(
    runtimeDirectory: @"C:\Program Files\HCL\Domino",
    notesIni: @"C:\Program Files\HCL\Domino\Data\notes.ini",
    idPassword: password);

Initialization failures now provide clearer diagnostics for common problems such as:

  • Missing or inaccessible notes.ini
  • Insufficient access to the Domino data directory
  • Incorrect Windows service account
  • Domino service-mode conflicts
  • x86/x64 architecture mismatches
  • Incorrect runtime or data directory

A practical .NET API for Domino

These features make it easier to build .NET applications that:

  • Compute and validate documents with Domino forms
  • Create and maintain databases
  • Manage full-text indexes
  • Work with named and profile documents
  • Use local transactions
  • Inspect and modify agent schedules
  • Retrieve all scheduled agents
  • Disable enabled agents in bulk
  • Diagnose standalone Domino runtime problems

DotNetToDomino combines the capabilities of the Domino C API with .NET-friendly convenience methods for common application and administration tasks.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.