Hi there!. I’m trying to build a small application to create contacts, and todo’s records, using the domino objects, but obviously I’m doing something wrong, because the code is not working.
My Setup:
Lotus Notes 8.5, using a local database only, no server.
C# and Visual Studio 2005/SP2
Here is my code (seems to be fine?):
bool result = false;
Session oNotesSession= new Session();
Domino.NotesDatabase database = null;
Domino.NotesDocument mydoc = null;
oNotesSession.Initialize(“”);
oNotesDatabase = oNotesSession.GetDatabase(“”, “names.nsf”,false);
if (!database .IsOpen)
{
database.Open();
}
database = oNotesSession.OpenNotesSession();
mydoc = database.CreateDocument();
mydoc.AppendItemValue(“FirstName”, “Jhon”);
mydoc.AppendItemValue(“LastName”, “Doe”);
mydoc.PutInFolder(“Contacts”,false);
result = mydoc.Save(true, false, false);
Running the code step by step, I noticed the following exception on mydoc object, under FolderReferences:
‘((Domino.NotesDocumentClass)(mydoc)).FolderReferences’ threw an exception of type ‘System.Runtime.InteropServices.COMException’
detail: {“Folder References are not enabled on the database”}
I tried to enable the FolderReferencesEnabled flag on the database object, but the code crash (Notes closes abruptly), probably “names.nsf” doesn’t allow FolderReferencesEnabled. Please help, and excuse me if this is a newbie error.
Thanks,
Aaron