Hi there,
I am trying to build a User interface to display all my contacts list and information in my contact list using the c++ toolkit.
An example will be suppose i have a person in my contact with the below information:-
First Name:John
Last Name:Smith
Office Number:12345678
Anyone there can tell me how retrieve the information?
Basically i have managed to opened the database and the document array and get some of the items. Am i doing the right thing? What is the next step i must do?
Thanks in advance.
hcl-bot
February 13, 2005, 10:23pm
2
Subject: Accessing Contacts using C++ toolkit
Problem solved using the function below. Thanks anyway.
void CLotusTest9Dlg::OnNewDoc()
{
LNNotesSession Session;
LNDatabase db;
LNViewFolder view;
LNDocument NewDoc;
LNText FirstNameText,LastNameText,DocType;
LNText NewEmail,OfficePhoneText;
LNString LFirstName,LLastName,LOfficeNo,LEmail;
CString CFirstName,CLastName,COfficeNo,CEmail;
Session.Init();
Session.GetDatabase("C:\\Program Files\\lotus\\notes\\data\\names.nsf", &db);
db.Open();
db.GetViewFolder("Contacts", &view);
view.Open();
MessageBox(view.GetName());
if(db.CreateDocument(&NewDoc)==0)
MessageBox("Document created");
NewDoc.SetForm("Person");
CFirstName = "Uchiha";
CLastName = "Sasuke";
COfficeNo = "77899654";
CEmail = "Sasuke@Uchiha.com";
LFirstName = CFirstName;
LLastName = CLastName;
LOfficeNo = COfficeNo;
LEmail = CEmail;
//Note: Cannot put CString into the function straightaway, so must put into LNString first
FirstNameText.SetValue(LFirstName);
NewDoc.CreateItem("FirstName",FirstNameText,LNITEMFLAGS_SUMMARY, LNITEMOPTION_DELETE_APPEND);//,LNITEMFLAGS_SUMMARY);
NewDoc.Save();
LastNameText.SetValue(LLastName);
NewDoc.CreateItem("LastName",LastNameText,LNITEMFLAGS_SUMMARY, LNITEMOPTION_DELETE_APPEND);//,LNITEMFLAGS_SUMMARY);
NewDoc.Save();
DocType.SetValue("Person");//standard field for 'Contacts'
NewDoc.CreateItem("Type",DocType,LNITEMFLAGS_SUMMARY, LNITEMOPTION_DELETE_APPEND);//,LNITEMFLAGS_SUMMARY);
NewDoc.Save();
OfficePhoneText.SetValue(LOfficeNo);
NewDoc.CreateItem("OfficePhoneNumber",OfficePhoneText,LNITEMFLAGS_SUMMARY, LNITEMOPTION_DELETE_APPEND);//,LNITEMFLAGS_SUMMARY);
NewDoc.Save();
NewEmail.SetValue(LEmail);
NewDoc.CreateItem("MailAddress",NewEmail,LNITEMFLAGS_SUMMARY, LNITEMOPTION_DELETE_APPEND);//,LNITEMFLAGS_SUMMARY);
NewDoc.Save();
NewEmail.SetValue(LEmail);
NewDoc.CreateItem("MailAddress",NewEmail,LNITEMFLAGS_SUMMARY, LNITEMOPTION_DELETE_APPEND);//,LNITEMFLAGS_SUMMARY);
NewDoc.Save();
NewDoc.Close();
view.Close();
db.Close();
Session.Term();
}