ConnectorLib .NET 25.2
ConnectorLib .NET SDK Programming Guide

# Browse a Repository

The `identifiers` fetch action provides information that can be used to browse a repository. It retrieves a list of documents that are present in the repository and generates an identifier for each document.

Action | Description | Method to override
--- | --- | ---
`/action=fetch&fetchaction=Identifiers` | Retrieve a list of documents that are present in the repository. | `identifiers`

## Declare the Types of Identifiers

Before implementing the action, you must specify the types of identifier that the connector can return. For example, a connector that retrieves information from a file system might return identifiers that represent folders and identifiers that represent files.

Declare each `IdentifierType` as `public static readonly` in the main connector class:

       public class FileSystemConnector : ConnectorBase
       {
          public static readonly IdentifierType IdFolder = new IdentifierType("Folder", IdAttr.Container);
          public static readonly IdentifierType IdFile = new IdentifierType("File", IdAttr.Document);
          ...
       }

These fields are automatically found by the default implementation of the `GetIdentifierTypes()` function on the `ConnectorBase` class:

       virtual public IIdentifierTypes GetIdentifierTypes();

The default implementation means there is no need for you to implement this function.

You can verify the identifier types you have declared by running `/action=GetStatus`, which returns the list of `IdentifierTypes` and attributes.

## Implement the Identifiers Action

To implement the `identifiers` action, override the `identifiers` method.

When you implement the action, you can choose whether your users must set the parameter `ParentIdentifiers` in the `identifiers` action request.

The parameter `ParentIdentifiers` accepts a comma-separated list of identifiers. The action should return identifiers for items that exist below the parent identifiers in the repository. For example, the user might specify an identifier for a folder and would expect the action to return identifiers for folders and files contained within that folder. Alternatively, the user might specify the root of the repository by including the special identifier `ROOT`. The following sample code demonstrates how to implement the `identifiers` action and handle these cases.

       public override void Identifiers( IIdentifiersTask task )
       {
         // Loop over all parent Identifiers provided in action request
         foreach ( IParentIdentifier parentIdentifier in task.Parents )
         {
           try
           {
             // The special Identifier "ROOT" is used to request the top level
             // Identifiers in the repository.
             if (parentIdentifier.IsRoot)
             {
               // Add children of repository root.
               // The parameters are: the parent identifier, an Identifier for the child item,
               // and a display name for the child item.
               // The task.MakeId() function returns an IdentifierBuilder that can be
               // used to build up the Identifier.

               task.AddIdentifier(parentIdentifier, task.MakeId().Reference(@"\Child").Type(IdFolder).Get(), @"\Child");
             }
             else
             {
               // Add children of provided identifier.
               // Use the information from the parentIdentifier to find the parent item,
               // iterate over children and call task.AddIdentifier for each child, for example:

               string childReference = parentIdentifier.IdentifierData.Identifier.Reference + @"\somefile.txt";
               task.AddIdentifier(parentIdentifier, task.MakeId().Reference(childReference).Type(IdFile).Get(), childReference);

             }
           }
           catch ( Exception e )
           {
             // If an error occurs while retrieving the children, this error can be
             // reported as associated with the parent Identifier.
             // You can report general errors throughout the task by omitting
             // the parentIdentifier parameter.
             task.AddError( parentIdentifier, e.Message );
           }
         }
       }

Copyright 2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery ConnectorLib .NET 25.2

Topic Title: Browse a Repository