How are arguments passed to NSSession.GetCalendar and NSSession.GetDatabase in the Notes C++ SDK?

I have configured Lotus Notes with the server 'alpha-romeo/dev' and my administrator has informed me that my user file on the Domino server is jlalande.nsf.  Therefore, my code to retrieve the Notes calendar is:

LNSTATUS status = session.GetCalendar(&calendar, "alpha-romeo/dev", "jlalande.nsf", "jlalande");

The documentation indicates that I have to open the database before retrieving calendar items, which I do with:

LNDatebase db;
status = session.GetDatabase("jlalande.nsf", &db, "alpha-romeo/dev");
status = db.Open();

However, db.Open fails with the message "File does not exist".

I suspect my parameters are not correct.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Where does it say you have to open the db first?
Here's an example from C++ API, Schedule:
//	Program:    Schedule
//	File:       SCHEDULE.CPP
//	Syntax:     SCHEDULE <filename> <ownername> <start date> <end date> <server>
//				A sample command line for schedule is:
//	schedule jdoe.nsf "Jane Doe" "07/08/98 9:00am" "07/08/98 10:00am" "Saturn"
//	(The date syntax is mm/dd/yy)
//	Description:
//				This program shows how to use the calendaring and scheduling 
//				features.
//  Note: 		This sample could take a minute or more to run if you have a 
//				large number of entries in your calendar.

#include <iostream>

#include <lncppapi.h>
#include <lncalend.hpp>

#define ERR_BUF_SIZE 512

using namespace std;

char CommandBuf[80];

int main(int argc, char *argv[])
	char *			File;
	char *			User;
	char *			Server=NULL;
	char *			Start;
	char *			End;
	LNNotesSession	Session;
	LNCalendar		Calendar;
	LNCalendarEntry	Entry;

	// Check the command line.
	if (argc < 6) 
		cout << "\nUsage:\n\t" << argv[0]
			<< " <filename> <username> <startdate> <enddate> <server> \n"
			<< endl;

	// Get info from command line.
	File = argv[1];
	User = argv[2];
	Start = argv[3];
	End = argv[4];
	Server = argv[5];

	// Set the error handler to throw all errors encountered during execution.

		LNDatetimeRange TheDate;
		LNText 			List;
		LNString 		DateString;
		LNString 		Desc;

		// Initialize the C++ API.
		Session.Init(argc, argv);

		// These must be done AFTER the session is initialized
		LNDatetime 		AptBegin ( Start );
		LNDatetime 		AptEnd (  End ) ;

		// Get a calendar
		Session.GetCalendar(&Calendar, Server, File, User);	

		cout << "Searching the file '" << File <<  "' on server '" << Server << "'..." << endl;

		// Check if a certain date is available
		if (Calendar.IsAvailable(TheDate))
			// Create an appointment type entry for this date
			Calendar.CreateEntry(TheDate, "My appointment", LNCALENTRYTYPE_APPOINTMENT, &Entry);

			// Get the brief description and display it
			Desc = Entry.GetBriefDescription();
			cout << "The description that was set was: " << Desc << endl;

			// Get the date information and display it
			TheDate = Entry.GetDatetimeRange();
			cout << "The date that was set was: " << DateString << endl;
			// Save the entry
			cout << "The date that you requested is not available" << endl;


	// Error handler.  If an error occurred then get the text of
	// the error message and display it.
	catch (LNSTATUS lnerror)
		char ErrorBuf[ERR_BUF_SIZE];
		LNGetErrorMessage(lnerror, ErrorBuf, ERR_BUF_SIZE);
		cout << "Error:  " << ErrorBuf << endl;

	cout << "All Done.  Hit return to exit: ";
	cin.getline(CommandBuf, 50);

	// Terminate the API.

	return (0);

Param rules:
LNSTATUS GetCalendar(LNCalendar *calendar, const  LNString &server = "", const LNString &dbname="", const LNString &ownername="")

    Output, pointer to object representing calendar.

    Optional input, reference to object representing name of server to search. If omitted or null, the local machine is searched.

    Optional input, reference to object representing name of mail database to use. If omitted or null, the user's mail file is used. The specified database is opened.

    Optional input, reference to object representing name of user. Depending on the setup of your Notes environment, you may need to specify a fully-qualified (hierarchical) name (for example, "John Smith/BOS/SmithCo"). If omitted or null, the current user is assumed.

Open in new window

jlalandeAuthor Commented:

I am double checking with the Domino administrator as to whether the file mentioned in my question 'jlalande.nsf' is actually the mail file listed in the server's names.nsf file.

I appreciate the links you've sent, but they mostly address the creation of calendar entries and I only need to read the existing entries.  Or was there something in particular in those that you thought could help me?

Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

You can also check the name and path of your mail file in your Office(Online) location document.
Local address book > Advanced > Locations
Mail tab > fields "Mail file location" & "Mail file"
jlalandeAuthor Commented:

I am using 8.5.1 FP2 and I don't see this option at all.
You can open the location document by clicking on the lower right corner in Notes client, where it says Online (if that's the name of your current location).
Click on that button and choose Edit locations...

That will open Preferences > Locations (that's the other way to get there: File > Preferences > Locations).
Select Online in the list and click on Edit... button.

Go to Mail tab.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jlalandeAuthor Commented:
This is it.  Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.