HPE Content Manager SDK 9.2
Release Notes

Content Manager 9.2

Checking for duplicate documents by hash

CR 62066

New methods / properties

New hashing related methods and properties are:

Comments

While it was possible to enable duplicate checking in the system options there was no programmatic way to check for uniqueness of a document using its hash, two new SDK methods support this. CalculateDocumentHash will calculate the hash for a local file and FindRecordsByHash will find any Records with documents that match the hash.

For systems that have previously use hashing for de-duplication existing hashes will be stored against Records on upgrade, otherwise after hashing is enabled only newly created Records will have a hash stored against them. CalculateHash may be used to retrospectively calculate hashes.

Sample Code

The following code:

  • generates a hash for a local file,
  • finds any Records that match this, and
  • notifies the user whether (or not) there are matching Records.
try
{
string hash = db.CalculateDocumentHash("c:\\temp\\temp.doc");
TrimMainObjectSearch recordSearch = db.FindRecordsByHash(hash);
List<string> numbers = new List<string>();
foreach (Record rec in recordSearch)
{
numbers.Add(rec.Number);
}
if (numbers.Count > 0)
{
Console.WriteLine(string.Format("This document '\\temp\\abc.doc' is already registered, Record(s) = {0}", string.Join(", ", numbers)));
} else
{
Console.WriteLine("The document '\\temp\\temp.doc' is not registered in TRIM");
}
}
catch (TrimException ex)
{
Console.WriteLine(ex.Message);
}

Searching for Record types: 'can contain' and 'can be contained in'

CR 61825

New Search Clauses

Two new search clauses make it simpler to find the correct Record type when creating a contained (or container) Record.

Updates to Lookupsets

CR 61030

New methods / properties

New LookupSet and properties are:

New LookupItem methods and properties are:

New LookupItem search clauses

Comments

Lookup Sets have changed significantly and the properties (and methods) reflect this, changes include:

  • hierarchical lookup sets: find child items via the search clause LookupItemParent
  • LookupSet type additional fields: use these fields to store a reference to the exact LookupItem rather than relying on the string value of the LookupItem

Issues with constructors

CR 61030

Comments

Some of the TrimMainObjects had issues with their constructors which have been fixed, these included:

  • Alert object would construct successfully but no alert appeared in the client.
  • RecordAction and Word had a constructors for creating new instances, these have been removed.

Sample Code

The following example creates a new Alert.

Alert alert = new Alert(db);
alert.ObjectType = BaseObjectTypes.Record;
alert.EventType = Events.ObjectModified;
alert.Criteria = "electronic";
alert.ChildSubscribers.NewSubscriber(new Location(db, 9000000049));
alert.Save();

IsValidFor throws an exception rather than returning false with information

CR 60946

Comments

Rather than returning false when a particular purpose was not valid IsValidFor was throwing an exception.

Sample Code

The code below calls IsValidFor on a Location.

Location loc = new Location(db, 1);
loc.IsValidFor((int)LocationPurpose.AddToBossOf);

Promote Revision function that works like the functions inside trim.exe

CR 60986

Comments

Ability to promote a revision to be the main document as could already be done through the native client.

Sample Code

Choose a particular record revision then promote it.

Record rec = new Record(db, 9000000000);
RecordRevision revision = rec.ChildRevisions.FindChildByUri(9000000001) as RecordRevision;
revision.Promote();

Database pool built into SDK

CR 61192

Comments

Calling Database.Connect() can take several hundred milliseconds to complete. This is not a problem in a client application where the connection is preserved for the life of the application but for a web service application it adds significant overhead to each request. The database pool optimises this connection process by storing each instance of the database in a cache and then on subsequent requests retrieving the cached instance instead of connecting a new instance.

Database pooling operated transparently as long as the database is connected in the appropriate way, as seen in the sample below.

New methods

Two scenarios where the pool should be flushed to prevent the usage of a stale connection are when a user option is changed or when SetDataGridVisiblePropertiesOrFields is called.

Sample Code

The database instance will be cached if a workgroup server name, trusted user and database Id are specified. The instance will remain in the cache for 5 minutes.

db.Id = "K1";
db.TrustedUser = "fred";
db.WorkgroupServerName = "local";
db.Connect();

Provide a HasPermission function for the TRIM main object

CR 61398

New methods

New methods are:

Comments

New methods to determine whether a user has the ability to perform certain actions in general and on specific objects and properties.

Prevent invalid extensions from interfering with the checkout process

CR 62054

Comments

Putting invalid characters in CheckInAs would cause an error when check the document out, these characters are now stripped from the file name on check out.

SDK methods to support field sorting

CR 62763

New methods / properties

New method and property are:

Comments

User defined fields are now sortable and the CanSort function allows a developer to determine whether a particular field is sortable.

SDK methods to support blocking of search methods

CR 63439

New methods / properties

New methods provided:

Comments

A system administrator can choose to "block" certain searching methods from normal users. When this happens, it is expected that these methods will not be presented in user interfaces for the currently logged in user. To assist in implementing such user interfaces, the extra methods above have been provided to allow SDK developers to filter out such blocked search methods.

Exposing the Initiating Workflow template concept in the SDK

CR 64493

New methods / properties

New methods provided:

Comments

This new property has been added in order that SDK applications can specify that a workflow be generated as part of the process of creating a new record. To do that you need to specify a valid workflow template in this property - the new workflow will be created based on that template. Note that this property is a little special in that it cannot be set for an existing record - if you try to do that you will get an error. It really is only applicable for new records. The value of the property is also "forgotten" once the record has been created.

Provide a way of "crawling" the repository without tripping the dateLastUpdateOn date

CR 64506

New methods / properties

New properties provided:

Comments

This boolean property of ExtractDocument has been provided so that you can write an application that extracts a copy of a record's document without setting the DateLastAction property of the Record. Typically the act of extracting a document can be seen as an "action" on a record and so the DateLastAction is set, together with a consequential update to the DateLastUpdatedOn property. If you turn it on, this property overrides the RecordType setting for "Set Last Action Date On View". It is useful for writing an app that must periodically check and extract any new content, and is relying on the DateLastUpdatedOn property to find recently updated records.