Monday, December 18, 2006

Using NotesSQL ODBC Driver and C# extract the .nsf file data

Using NotesSQL ODBC Driver and C# extract the .nsf file data to XML file format or any other format.

NoteSQL ODBC Driver Download Click Here

Sample Code:

public XmlDocument GetFromNSFdb(string strNSFdbName)

{

Domino.ISession session = new NotesSessionClass();

session.Initialize("");

Domino.NotesDatabase database = session.GetDatabase("", strNSFdbName, false); Domino.NotesNoteCollection noteCollecton = database.CreateNoteCollection(true); noteCollecton.SelectAllAdminNotes(true);

noteCollecton.SelectAllCodeElements(true);

noteCollecton.SelectAllDataNotes(true);

noteCollecton.SelectAllDesignElements(true);

noteCollecton.SelectAllFormatElements(true);

noteCollecton.SelectAllIndexElements(true);

noteCollecton.SelectForms = true;

noteCollecton.BuildCollection();

Domino.NotesDXLExporter exporter = (Domino.NotesDXLExporter session.CreateDXLExporter();

string strNsfXML = exporter.Export(noteCollecton);

// removes the string strDocrmv = strNsfXML.Replace("", "");

// removes the xmlns='http://www.lotus.com/dxl'

strDocrmv = strDocrmv.Replace("xmlns='http://www.lotus.com/dxl'", ""); XmlDocument xDocLoad = new XmlDocument();

xDocLoad.LoadXml(strDocrmv);

return xDocLoad;

}

No comments:

ASP.NET MVC - Sport Facility Booking system

  The project relies on some external service providers. Thus accessing them via their API requires authentication. An API Key need to be su...