ITQuants blog

.Net and Domino parser, using Interop.Domino.dll with C#

Mar 2

Written by:
3/2/2012 12:54 PM  RssIcon

Working on a project on which I have to analyze Lotus documents, I have to make some extraction in order to insert them into one Oracle database.

For this stuff, I'm using the .Net Interop.Domino driver which pretty fine to parse all documents of a ".nsf" file.

One of the most important difficulties is to get information using the IBM tags, which are, from the time being, the following ones, with usefull links to the IBM constant fields:

 

Constant Field

Value

DOMINO_ITEM_BLIND_COPY_TO

"BlindCopyTo"

DOMINO_ITEM_BODY

"Body"

DOMINO_ITEM_COPY_TO

"CopyTo"

DOMINO_ITEM_DELIVERED_DATE

"DeliveredDate"

DOMINO_ITEM_ENCRYPT

"Encrypt"

DOMINO_ITEM_FONTS

"$Fonts"

DOMINO_ITEM_FOOTER

"Footer"

DOMINO_ITEM_FORM

"form"

DOMINO_ITEM_FROM

"From"

DOMINO_ITEM_HEADER

"Header"

DOMINO_ITEM_INET_BLIND_COPY_TO

"InetBlindCopyTo"

DOMINO_ITEM_INET_COPY_TO

"InetCopyTo"

DOMINO_ITEM_INET_FROM

"InetFrom"

DOMINO_ITEM_INET_PRINCIPAL

"$INetPrincipal"

DOMINO_ITEM_INET_TO

"InetSendTo"

DOMINO_ITEM_LINKS

"$Links"

DOMINO_ITEM_MODIFIED_DATE

"OriginalModTime"

DOMINO_ITEM_POSTED_DATE

"PostedDate"

DOMINO_ITEM_PRINCIPAL

"Principal"

DOMINO_ITEM_RECIPIENTS

"Recipients"

DOMINO_ITEM_REPLICAID

"replicaid"

DOMINO_ITEM_SMTPORIG

"SMTPOriginator"

DOMINO_ITEM_SUBJECT

"Subject"

DOMINO_ITEM_TO

"SendTo"

DOMINO_ITEM_UNID

"unid"

MAXFACESIZE

32

NOTES_PROPERTIES_XML_ATTR_HLKEY

"highlightKey"

NOTES_PROPERTIES_XML_ATTR_NAME

"name"

NOTES_PROPERTIES_XML_ATTR_TYPE

"type"

NOTES_PROPERTIES_XML_FIELD

"prop"

NOTES_PROPERTIES_XML_NAME

"/notesProperties.xml"

NOTES_PROPERTIES_XML_ROOT

"properties"

 

 

Please find below a sample of code using the Domino driver in C#:

 

 

for(int i = 0; i < _database.AllDocuments.Count; i++)

 {

NotesDocument _document = _database.AllDocuments.GetNthDocument(i);

if (_document != null)

 {

 int _fileId = GetFileId(ref _conn, f.FullName);

 if (_fileId == -1)

 break;

 

String _ident = _document.UniversalID;

 //String _author = (String)((Array)_document.Authors).GetValue(0);

 //object _oposted = _document.GetItemValue("PostedDate");

 //DateTime _posted = (DateTime)((Array)_oposted).GetValue(0); ;

 //DateTime _posted = (DateTime)_document.LastModified;

 

String _encrypted = _document.IsEncrypted ? "O" : "N";

  

object _oposted = _document.GetItemValue("PostedDate");

 

DateTime _posted = (DateTime)((Array)_oposted).GetValue(0);

Array _afrom = (Array)_document.GetItemValue(

"From");

 

String _from = "";

 

for (int j = 0; j < _afrom.Length; j++)

_from += (String)_afrom.GetValue(j) + "\n";

 Array _ato = (Array)_document.GetItemValue("SendTo");

 String _to = "";

 for (int j = 0; j < _ato.Length; j++)

  _ato += (String)_ato.GetValue(j) + "\n";

 Array _acc = (Array)_document.GetItemValue("CopyTo");

 

String _cc = "";

 for (int j = 0; j < _acc.Length; j++)

 _cc += (String)_acc.GetValue(j) + "\n";

 

Array _abcc = (Array)_document.GetItemValue("BlindCopyTo");

 String _bcc = "";

 for (int j = 0; j < _bcc.Length; j++)

 _bcc += (String)_abcc.GetValue(j) + "\n";

 object _osubject = _document.GetItemValue("Subject");

 String _subject = (String)((Array)_osubject).GetValue(0);

 object _obody = _document.GetItemValue("Body");

 String _body = (String)((Array)_obody).GetValue(0);

Tags: C# , Domino , Lotus , email , tag
Categories: C#

Search blog