BorrowerInfo Method

The BorrowerInfo method is a public function in the Critique component that verifies that a reviewer exists in the borrower table of the FmLib database and returns the unique identifier of the borrower (borrower#) to the LitCrit server-side script.

Two parameters, LDAPString and Server, are passed to the BorrowerInfo method. The LDAPString argument contains a string that points to an individual recipient in the Microsoft® Exchange Server directory and the Server argument is the server name.

Three methods are called from the BorrowerInfo method:

First, the BorrowerInfo method calls the ParseString method, which accepts LDAPString as an argument and is responsible for separating the string into Organization, OrgUnit, and Alias.

Second, the User component in CML.dll is instantiated and a call is made to the GetInfoFromTable method passing the alias of the reviewer as a parameter. About the User Component describes in detail the User component coded for the Corporate Media Library application. The alias was returned to the BorrowerInfo method from the ParseString method as the value in varValues(4). The purpose for calling the GetInfoFromTable method is to determine if a record with this alias already exists in the borrower table of the FmLib database. The GetInfoFromTable method retrieves the borrower# in the borrower table and returns a borrower number of 0 when no match for the alias is found in the borrower table.

Set oUser = MTS.CreateInstance("CML.User")
BorrowerNo = oSearch.GetInfoFromTable(varValues(4)) 'varvalues(4) = alias
   

Third, a borrower number of 0 indicates that a record needs to be added to the borrower table and a call is made to the UpdateInfoFromExchange method passing the following parameters: the server name, organization as varValues(1), organizational unit as varValues(2), and alias as varValues(4), The UpdateInfoFromExchange method adds a new record in the borrower table and returns the borrower# of the inserted record.

If BorrowerNo = 0 Then
   BorrowerNo = oUser.UpdateInfoFromExchange(Server, varValues(1), varValues(2), varValues(4))
End If
   
BorrowerInfo = BorrowerNo

The Critique component is instantiated in the server-side script that runs when the Folder_OnMessageCreated event fires on the public folder in which the critiques are posted; the BorrowerInfo method in the Critique component is then called. The BorrowerInfo method returns the borrower# to the LitCrit application's server-side script where it is examined. If the borrower# is 0, indicating the borrower record does not exist in the borrower table, a critique record cannot be added to the FmLib database because of the foreign key constraint between the Critique and borrower tables. Updating the FmLib Database and Adding the Critique Table describe the foreign key relationships of the Critique table.

The complete code for the BorrowerInfo method is available in Critique.cls Server-Side COM Component in the code section.