Updating SQL Server from the Exchange Information Store

As a reviewer, you can choose to make your critique available to the CML application. If you share your critique with the CML, a critique record is added to the FmLib Critique table, and the overall rating and critique title properties from the LitCrit Outlook form are copied to the critique record. If permissions on the LitCrit public folder allow edits, you can edit critiques from Outlook and the associated record in the Critique table needs to be updated. Scripts executed by events on the public folder will keep critique information in Exchange and SQL Server in sync. When you choose not to contribute your critique to the CML, no FmLib critique record is created and SQL Server need not be updated from Exchange.

The following tasks — all executed through the Microsoft Outlook interface — cause information stored in the Microsoft Exchange Server information store to be changed, which necessitates a corresponding change in the FmLib SQL Server database.

Add a critique from Outlook

When the Folder_onMessageCreated event fires on the LitCrit public folder, the script associated with the event runs, the Critique COM component (Server-Side Critique COM Component) is instantiated, and the AddRecord method in the Critique component adds a new record to the FmLib Critique table. When approval of critiques is required, the FmLib critique record is updated when the critique is approved or deleted when the critique is rejected. Scripts that update or delete the critique record run as a result of triggering the Message_onChanged or Folder_onMessageDelete events on the LitCrit public folder.

Edit a critique from Outlook

When the Message_onChanged event fires on the LitCrit public folder, the script associated with the event runs, the Critique COM component is instantiated, and the UpdateRecord method in the Critique component updates the record in the Critique table of the FmLib database. If approval of critiques is required, the critique is resubmitted for approval.

Delete a critique from Outlook

Deletes in the FmLib Critique table occur for two reasons: a person deletes a critique from the LitCrit public folder or the critique is rejected by the approver. When the critique is deleted directly from the folder script, the Folder_onMessageDeleted event fires, causing a script to run that updates the associated critique record in the Critique table and sets the objectId (the unique identifier of the LitCrit posting) to NULL. The information in the SQL Server table, though the critique text and some ratings are no longer available, is still of value. Deletion of a critique by the approval/rejection process deletes the associated record in the Critique table.

Delete the LitCrit public folder

When the LitCrit public folder is deleted, the Folder_onMessageDeleted event fires for each critique in the folder. The script triggered by the event firing updates the associated critique record in the Critique table and sets the objectId (the unique identifier of the LitCrit posting) to NULL.