Exporting data from Lotus Notes: C# interop, C, Java or LotusScript? - lotus-notes

I'm about to export a lot of data from a Lotus Notes db, and I'm wondering if anyone can shed any light on how exactly I can move forward on this point.
Notes has some views (lists with custom templates?) of some kind - are these saved in .nsf files on the Domino server, or are the .nsf files for email only?
If the .nsf files are actually the database files, what would be the best language / development pack to use to pull data from them?

If you need full-time synchronization between an existing Notes infrastructure and a RDBMS, LEI (Lotus Enterprise Integrator) or a third-party tool like Notrix would be your best bet -- it's as simple as defining a job and a schedule/trigger to run it. If you need to occasionally pull (or push) a subset of the data, then NotesSQL is probably the easiest approach. If you're not afraid of learning the structure of the NSF (Notes Storage Facility), then the LotusScript/COM API or the Java/CORBA API would give you finer-grained control.
If what you really need is a one-time dump of everything, then exporting all of the data notes to DXL (Domino XML) would give you the most complete version of the data you're going to get, and in a way that would let you recover and convert formatted Notes Rich Text, file attachments, and so on in a way that would be incredibly difficult to achieve otherwise. DXL is verbose, so don't say I didn't warn you, but it is pretty comprehensive as well. (The DOmino Designer Help entry on the NotesDXLExporter class has example code that is exactly on point.)

It all depends on what language you're familiar with.
If you know LotusScript well, then that would be my first choice since it's the most integrated with the platform.
If you don't know LotusScript that well, but you know C#/Java/C really well...then you shouldn't have any trouble using any of those APIs (and they should all be able to get the job done equally as well).

In Lotus Notes Domino all the data is stored in the .nsf files. This is true for all Notes databases, not just email. The data is all stored in documents which are basically collections of named fields containing values. The views are simply ways of indexing and displaying collections of documents based of specific criteria. The views can also calculate values based on the value of a field in the documents.
The Notes LotusScript and Java APIs are essentially identical and would be the simplest way to programmatically access the data. The C API is much lower level and probably overkill for this kind of thing.

You could look at NotesSQL, if you want to create an ODBC connection to an NSF file to pull data into SQL or Access. If all the data is contained within the view you could simply select all the documents and click Edit > Copy Selected As Table and paste into Excel.
To answer your other questions: Notes views are similar to SQL views - essentially a query on the data stored within the NSF. NSF files contain both the data and the structure of the application in one file.

Related

How can I push Lotus Notes documents with rich text fields and file attachments to a MySQL database?

We are using v9.0.1 and have one application that we must preserve for the time being. I am hoping to expose this database's documents with all content to a MySQL database for which we will develop a web front-end to present the records read-only. I know I can export the data to text files or to XML, but I want to retain the formatting of the rich text fields and the files that have been added to them (there are several per document). I've emailed the documents in an agent to a document management system, but the content of the rich text fields is stripped of any formatting and all the data I output is presented in a plain .txt file, but the attachments are preserved. I am hoping to provide a more elegant solution.
Any ideas will be appreciated.
Ginni
The Domino router can do rich text to HTML conversion, so if set up properly you won't lose all your formatting -- but you still won't get great fidelity. I used that technique in an archiving product that I built 15 years ago, but it was only "good-enough" fidelity, and it was only for Notes email messages. There would be more to do if you're dealing with application documents. It's been too long, so I can't recall any specific details.
If you can spend money on this, the migration tool from Genii Software will help. Look up their AppsFidelity Migrate product. There may be some other third-party products that you could work with, but this one comes from a company that has been 100% dedicated to dealing with Notes rich text for decades. If you call them, tell Ben that I sent you.

Get view index sizes programmatically

I'm familiar with the "Manage Views" tool in Domino Administrator, and wondered if anyone had come up with a way to access the view Index size programmatically. Ideally I'd use LotusScript but any other method would be great too.
I'm hoping to analyze which views are actually used across a large number of databases, without having to extract the info manually.
AFAIK this is not possible in LotusScript. But the index size could be retrieved with the C-API function NIFGetCollectionData.
You need to open the database with NSFDbOpen, get the view with NIFFindView, open the view with NIFOpenCollection and finally get the size with NIFGetCollectionData. And of course you need to call NIFCloseCollection and NSFDbClose to clean up.
Maybe there is an easier way, but you'll probably have to develop the necessary tooling yourself. A small quest in 6 steps:
open the log.nsf database for your server
open the view Usage/by Size
open a usage document for a fairly large database, e.g. mail/yourmail.nsf
the document shows all views and their (index) sizes
open the Document Properties box (Alt-Enter)
the field AllViewInfo (RichText) contains that data
Downsides:
AFAIK there is no ready-made LotusScript library for log.nsf.
those sizes are collected during the night, so they're not up to date
going through a rich-text's data can be daunting
HTH

Is it possible to take input from a file in NotesSQL

For example I have to run a query to fetch data for a list of part numbers.
The list is very big say 1000. So I do not want to give all the part numbers in the query instead want to take it from a file say .txt or .xls
Is It possible with Notes SQL?
Why use Notes SQL to import data from a text file into Notes? Just write a Lotusscript agent that does the import.
Notes SQL is just a driver that maps SQL queries onto Notes and Domino databases, views, and documents. It's up to you to construct the queries and run them somehow.
There's nothing in the syntax of NotesSQL that can take input from files.
If the program that you are using to generate and run the Notes SQL queries has the ability to read files and use the contents of a file to modify the query before giving it to NotesSQL, then the answer is yes, it's possible to do what you want with Notes SQL.
You have it all backwards. NotesSQL lets you query (pull data out of) a Notes database (.nsf) using ODBC. That way any software that can connect via ODBC has access to Notes data. It doesn't allow importing data into Notes. To get the data into Notes you'll need to either write a script or use something like IBM Enterprise Integrator (IEI, formerly LEI, formerly formerly Notes Pump.)

generate multiple pdfs from a database

I would like to generate multiple pdfs at once. Those pdfs should pull data from a database. It can be an excel table or a relational database, doesn't matter, I can create whatever.
Using excel and javascript in adobe acrobat pro I managed to pull data into a template pdf, but for every record (row) I have in excel table I have to manually generate one pdf, then another, and so on.. and there are a lot of records, so I would like to do that automatically if possible.
Is there a way to do that? Any suggestions?
I added an image to better explain it...
Look into the Acrobat SDK, Section: "Interapplication Communication" to learn how you can control Acrobat via VB/VBA and how you can work with the JavaScript Object (JSO).
Then have a look into the "Acrobat JavaScript Scripting reference" and look at
the Doc Object with commands like .. addField and at
the Field object to set the properties of the fields.
That should do what you want, Reinhard
PS: With Open Office you can save spreadsheets as PDF and with newer version of Excel too. Wouldn't that be already enough or perhaps a mix of above and this.
Full disclosure: I founded and run Epsillion Software.
mirta, one option is Epsillion Publisher. We built it for your exact use case.
You would need to specify what your template should look like. The Epsillion team will design it for you.
You then specify what your variables are in a Word document (e.g., name, last name, date of birth). The software will process the Word and Excel files and return PDFs for you.
Templates are flexible and flow as needed.
Hope that helps. Good luck!

Convert IBM Lotus Notes file to text

How can I convert an .nsf lotus file to a text file? i want to write a java program to read .nsf file which is on my system. i have tried it simply but it is showing non english character is their any way to get access them normaly.
EDIT:
That code is in .net and using any server's session, I just want to read .nsf file by java without creating any server's session in fact i have .nsf database. i just want to read as a text file.if there a way to parse .nsf with javacc,it would be better enough......
lotus notes database is full of proprietary design components. Assuming you just want to export the data, you will need to write an agent, (aka batch process), that would look at all documents in the database and then export all the fields into a plain text file.
If you're into XML, you can export data in that format as well, but again, you will need to write an agent for that.
Alternatively, there are some basic builtin mechanisms in Lotus Notes to export data but this is restricted to running them from views. Views do no necessarily get all the documents. You can design a view to do that though.
Providing the size of the database is not extremely large, (less than 200k documents), you can create view listing all the columns you want to export and a view formula that has "Select #All", will give you all documents. Then, the "quickest" way to get data out from a view can be found here using simple export procedure.
There is still the issues of exporting rich media, you can have a look here for that.
You can export some data easily by selecting all the documents in a view, and then going to Edit > Copy Selected As Table. Then just paste the content into Excel or a text file.
To access the data beyond what is showing in a view, you can try a few other things:
Connect to the data using the NotesSQL driver
Connect via the COM api (using Java, C#, VB, etc)
Create some views in Lotus Notes that DO have the data you need, and use my recommendation above.
Install and and my Export to Excel application

Resources