How to find NoteID with lotus notes api when given as text input

Quick decription: Program outputs a message on the Domino console for Message ID B21FEDE97AB9BDC5852577B30021E2EF. The program is going through all the databases and so I want to determine where that message is.

So I am guessing this message ID must be the NOTEID but not really sure. So based on that I would think I could open every database and if I can open that NOTEID then the note exist in the database. Not sure yet either if this is unique to all databases but if not I may find more than one database with the NOTEID but this is okay because now I would only have one document per database that could be the message I am looking for.

Here is sniblet of code I would think would work but doesn’t because string for note ID can not be type casted as NOTEID.

DBHANDLE db_handle; /* database handle */

NOTEHANDLE note_handle;     /* note handle */

STATUS     error;           /* return code from API calls */

char MyNoteID = "B21FEDE97AB9BDC5852577B30021E2EF";

/* Open the database. */

AddInLogMessageText("Searching database %s.", NOERROR,db_name);

if (error = NSFDbOpen ("testdb", &db_handle))

    return (ERR(error));



if (error = NSFNoteOpen (*(DBHANDLE*)db_handle,	(NOTEID) MyNoteID, 0, &note_handle))

{

	AddInLogMessageText("Could not find document ID: %s.", NOERROR,MyNoteID);

	return (ERR(error));

}



AddInLogMessageText("Found document ID: %s.", NOERROR,MyNoteID);

So note sure if this can be changed to work or if I should do something else. But any help would be greatly appreciated. Again just trying to find a document based on the message ID within all databses so that I can try to find the message that was mentioned on the console.

Thank you

Subject: Figured this out…

There was small discussion about this in the Notes 4/5 forum. Go there and then search for NSFNoteOpenUNID and onlye small few hits will come back. Basically someone posted how to convert the text based unique ID into a UNID struct type. Then you can pass this UNID into the NSFNoteOpenUNID function.

Subject: seems you are not using NoteID

Hello your string is too long and looks like a UNID. The NoteID is smaller than that. You could use NSFNoteOpenByUNID but you would have to convert the textual UNID first. I mentioned this in previous message. Go there to see how to convert textual UNID into struct UNID.