Unique ID of 'Contact' database

Hi there. Currently i am trying to build a program to retrieve data records from the ‘Contact’ list database from names.nsf. I realise that the documents from the contact database does not have a unique ID attached to in.

From my understanding, there is an ID attached to every document. However, i have look through the document properties and fail to find the attribute to retrieve the ID. I was wondering if there is anyway to retrieve the unique ID of the document? Maybe there are somehing i have missed out somewhere?

Thanks to everyone that can help in advance.

Subject: Unique ID of ‘Contact’ database

Hi ,

The unique id of a doucment is available through a couple of methods , depending on what development language you are using.

In formula, it is @DocumentUniqueID , this is a special data type to you have to wrap it in @Text. So @Text(@DocumentUniqueID)

In lotusscript you can use the universalID property of the notesdocument. Here is some example code.

Place this code in the initialize event of a lotusscript agent that runs on selected documents, save the agent, switch to a view select a document and run this action.

’ COde starts

Dim Sess As New NotesSession

Dim DB As NotesDatabase

Dim Doc As NotesDocument

Set DB = Sess.CurrentDatabase

Set Doc = DB.UnprocessedDocuments.GetFirstDocument

If not Doc is nothing then

msgbox "The Unique ID of this doc is: " + Doc.universalid

End if

Subject: RE: Unique ID of ‘Contact’ database

Hi Simon, thanks for your reply. Just to confirm, suppose i am using c++ to develop my codes, do i use

GetText(“@DocumentUniqueID”,&MyString)to retrieve the document? or is there another way to cast the DocumentUniqueId into a LNString data type?

By the way, thanks a lot for your reply.

Subject: RE: Unique ID of ‘Contact’ database

Hi Simon, it is ok now…I got it already. Below are my sample code to retrieve the UniversalID and cast it into a LNString.

Thanks a million dude. Really appreciate your help.

LNNotesSession Session;

LNDatabase db;

LNDocument EntryDoc;

LNUniversalID MyUNID;

LNString MyString;

Session.Open();

Session.GetDatabase(&db);

db.GetDocument(&EntryDoc);

EntryDoc.Open();

MyUNID = EntryDoc.GetUniversalID();

			MyString= MyUNID.GetText();

			MessageBox(MyString);

EntryDoc.Close()

db.Close()

Session.Term()