Run formulas on Notes from .Net assembly

Saturday, 7 February 2009 12:57 by FirozOzman

When you intergrate Domino Lotus Notes with any external system, it's a bit of COM interop coding effort you have to go thru. Same is the case, even if you are using BizTalk Server. There is no adaptor commercially available which does the job what you are looking to do.

Here is my five cents on how to execulte formulas on a Lotus Notes Document from a .net assembly using interop dlls.

I am using BizTalk to integrate SAP with Notes. As we know SAP integration at Send and Recieve ends of BizTalk is quite straight forward until you want to let SAP have control on this. When you want SAP to have control on this, the only option is to let SAP drop the required files or access required files from an FTP or File location. You can possibly use XML or Flat file files to represent data that SAP can use. Well, I'm losing the topic here.

Coming back to Notes integration at the othe end of the BizTalk needs custome .net component or if you have a world of time to deal with Custom Adaptors, you can opt it.

In the .net component you build, right after you do the Document field append(nDoc.AppendItemValue("AccountingDate", "20022009");) or Replace (nDoc.ReplaceItemValue("Form", "Invoice");), In other words Create or Update, you gotta save the document.

if (!nDoc.Save(true, false, false)) throw new Exception(@"Failed to Update Portal Invoice with Invoice Number: " + invoiceNumber);

A call to ComputeWithForm has to be fired right before the Save for the formula execution on this document.

if (!nDoc.ComputeWithForm(false, false)) throw new Exception(@"Failed to execute formulas for Portal Invoice with Invoice Number: " + invoiceNumber);

More on this method at https://sametime.aspeninstitute.it/help/help65_designer.nsf/f4b82fbb75e942a6852566ac0037f284/
2a3fdfb3f8f4261385256d9b00442708?OpenDocument

Happy Coding!

Coming up in the BizTalk series : Port failure Notifications from BizTalk without using MOM!

Lotus Notes Integration using BizTalk

Monday, 15 December 2008 12:53 by FirozOzman

Notes Integration from any third party application is not an easy straight forward thing. However Interop.Domino.dll provided by IBM Domino helps do all basic operations on a Lotus Notes Database.

When it comes to using BizTalk to integrate with Lotus Domino, there is no LOB Adaptors available with BizTalk. Not even 2006R2. Well, there is no even a third party BizTalk Adaptor for this purpose.
There are few providers for universal adaptors for Notes but, it takes the same effort as using Interop.Domino.dll and code out your interface.

Following link will help you get a detailed SDK typed details on each classes and its usage from the Interop assembly for Notes.
https://sametime.aspeninstitute.it/help/help65_designer.nsf/Main?OpenFrameSet&Frame=Topic&Src=%2Fhelp%2Fhelp65_designer.nsf%2FContentsIntro%3FOpenPage%26AutoFramed

Here is an example on how such a simple interface may look:

NotesSession nSession = new NotesSession();
NotesDatabase nDB;
NotesDocument nDoc;
nSession.Initialize("mypassword");
nDB = nSession.GetDatabase(@"ServerName", @"DatabasefileName", false);
if (nDB == null) throw new Exception("Notes Database not available");
if (!nDB.IsOpen) nDB.Open();

nDoc = nDB.CreateDocument();
nDoc.AppendItemValue("ItemNo", "00001");
nDoc.AppendItemValue("ItemName", "Rubber");
if (!nDoc.Save(true, false, false)) throw new Exception(@"Failed to save");