Вопрос

I am trying to write a webservice to add new contacts to my existing contacts. I access my names.nsf file using the code below. I am new to Lotus Notes. Can anyone please post the code to access contacts in Java. Any related references would also be helpful.

Session session = getSession();
AgentContext agentContext = session.getAgentContext();
DbDirectory dir = session.getDbDirectory(null);
Database basedb = dir.openDatabase("names");

Thanks..

Это было полезно?

Решение

Your original question did not mention the creating of a new document, only how to access contacts.

Based on your comment

thanks..now i am able get all the views present in names.nsf in the domino designer..but stil unable add a new contact

the code in Java to create a new document in the names.nsf database (once you have a handle on it) would be...

Document doc = dir.createDocument();
//fill in the necessary fields
doc.save();

Другие советы

Hi its time to answer my question

If you are working on creating contacts in lotus notes account using java.Please follow the below steps in an agent.you can later turn this into web service easily

1.Create a session.

Session m_session = getSession();

2.Get the database

DbDirectory dbdir = m_session.getDbDirectory("");
Database m_database = dbdir.openMailDatabase();

3.Get a new document

 Document doc=m_database.createDocument();

4.Set the required properties of the document using

doc.replaceItemValue method.

for example

 doc.replaceItemValue("FillName","yourName");

5.Save the document and thats it.

doc.save();

If you use the names.nsf database the contact will be added only in the local copy of your client application and not the same is not reflected in the server copy.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top