logo

Create a Backup ZIP File of NSF Content in HTML Format

Some time ago I added a demo to the DEXT database that showed how to create a Notes document which contained a Zip file which, in turn, contained the contents of the NSF in HTML format. A backup file, if you will.

Although the demo is there and I can see people have used it, it was always my intention to talk about it on here. So, here goes.

The Concept

The concept is simple -- a WQS Java agent loops a view and creates a HTML file for each document and then adds it to a Zip file. At the same time it also creates an "index.html" file with links to all these HTML documents.

The index file is added to the root of the Zip file and the HTML documents are added to a subfolder within it.

When the WQS agent has done it attaches the Zip file to the "backup" document that is being created and this is then presented to the user for them to download and keep.

What This Looks Like

When you download and extract the Zip file you end up with a fully navigable website in a folder. You can then upload the folder to a normal web server and it would still work.

Here's an example Zip file I created earlier. Download and extract it to see for yourself.

Here's what the root of the extracted folder looks like:

backup1

Opening the index file would show you a list of all the articles within it.

Notice there's also subfolders. In this case it's called "articles" but you could call it anything and/or have more than one to match the View structure of the source database.

If you look inside the "articles" folder you'll see something like:

backup2

See how there's a HTML document for each Notes document and they have the name of the original document's UNID.

Notice also that there are subfolders that also have the name of document's UNIDs. These subfolders contain any attachments (inside a further subfolder called "$file").

backup3

In the example Zip's index file looks for the article near the bottom called "The day before the 25th" and open that. Notice the inline image is intact!

Why?

Good question. You could of course make a backup just by creating a new copy of the NSF. However, what if, say, you wanted to migrate away from Domino, or you were leaving a company and going somewhere without Notes. Etc. Whatever the reason it's a useful tool.

The Code

The code of the demo is all inside the latest DEXT download. If you can't be bothered to download and look in there just to get an idea what the code does, then here are two Java files which contain all the code: Backup.Java and ZipIt.Java.

YMMV

Comments

    • avatar
    • Aaron Hardin
    • Thu 6 Aug 2009 04:54 AM

    Nice tip.

    Thanks, really enjoyable read and something to think about.

  1. More great stuff! This is useful on several different levels including to dispel the 'Notes is too proprietary' argument. You have provided an easy way to export Notes data for use on another system if necessary.

    • avatar
    • Palmi
    • Thu 6 Aug 2009 08:07 AM

    Nice jake,

    Here is what i see a use for this. WithIn the Company org i work in we have few small companies that are not in Notes but need to get information from Domino from time to time. They could have Inotes licence but with this solution they can just read it from web. very nice.

  2. Now, why would one ever want to migrate away from Domino.

  3. This looks very similar to what we did to be able to respond to an e-discovery request. Most discovery systems (e.g, Applied Discovery, Attenex) are not able to read Notes applications (other than e-mail), so we needed to extract the documents and metadata into files that could be indexed by the discovery vendor's system.

    I wish we had this code last year!

  4. Jake, cool looking application, going to check it out.

    @Scott Joyner, if you are referring to Discovery Attender, it certainly can search any .nsf (as well as other non-Notes data.)

  5. This is sweet. Thanks and well done again Jake.

    • avatar
    • PaulG
    • Fri 7 Aug 2009 11:27 AM

    Awesome, thanks for sharing!

  6. Hi Jake , I've downloaded and install your nsf example on my server but it couldn't work on my server . I've mornitored my server console. It showed error message like this

    18/08/2009 13:19:36 HTTP JVM: java.lang.NullPointerException

    18/08/2009 13:19:36 HTTP JVM: at ZipContent.NotesMain(ZipContent.java:65)

    18/08/2009 13:19:36 HTTP JVM: at lotus.domino.AgentBase.runNotes(Unknown Source)

    18/08/2009 13:19:36 HTTP JVM: at lotus.domino.NotesThread.run(Unknown Source)

    Can you tell me how can I solve this problem ?

    • avatar
    • Jake Howlett
    • Tue 18 Aug 2009 02:12 AM

    Hi Chairman,

    My guess is that there are no documents for it to archive. The demo uses documents from the calendar view. Find the calendar demo from the demo app's homepage and add some documents. Then retry.

    • avatar
    • Chair
    • Tue 18 Aug 2009 03:00 AM

    Oh , thank you very much Jake , I get now

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Thu 6 Aug 2009

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content