How can I refresh Notes view using C API?

Hi-I’ve created a simple add-in to Notes in C that creates a new Contact in the contact list. If the Notes client is open, the new contact does not appear on the screen until I hit the F9 refresh key.

Is there a way to force the Notes client to refresh the view from within my C program?

Thanks!

Nicholas

Subject: How can I refresh Notes view using C API?

Since you did not post any code, its not easy to help. In the notes world, its a simple call to view.refresh.

Subject: Use NIFOpenCollection()

which will bring the view up to date. To build the index from scratch, you can use OPEN_REBUILD_INDEX as the 4th parameter, but that shouldn’t be required, because a simple NIFOpenCollection will update the view automatically, if it changed.

Thomas - IBM

Subject: RE: Use NIFOpenCollection()

That will update the on disk view, but are you sure it will update the UI view. I didn’t think the Notes API would do that.

Simon

Subject: RE: Use NIFOpenCollection()

Thanks for the responses. I actually experimented with NIFOpenCollection() and it does not force the client to refresh it’s screen.

I can post no code since I don’t have a solution to the problem :slight_smile:

In essence I want to do the same thing that an F9 keypress does in the client.

Any other ideas? :slight_smile: Many thanks!

Nicholas

Subject: RE: Use NIFOpenCollection()

You haven’t given enough info to suggest solution, no idea how you are integrating C-API with the Notes UI. Maybe it is possible to call your API code from LotusScript which can do the refresh after the C call returns.

Also, if i remember correctly, view export addins cause a view refresh so maybe thats an integration option.

Simon

Subject: RE: Use NIFOpenCollection()

I’ve created a small stand-alone C program that puts new contacts into the notes database using the C API. It links with various Notes DLLs. It must be able to run on its own, without a call from any script language or user input.

Here is the code snippet for adding a contact:

NOTEHANDLE hNewNote;

ret = NSFNoteCreate(hdb, &hNewNote);



ret = NSFItemSetText(hNewNote, "Form", "Person", MAXWORD);

ret = NSFItemSetText(hNewNote, "Type", "Person", MAXWORD);

ret = NSFItemSetText(hNewNote, "LastName", "Flintstone", MAXWORD);

ret = NSFItemSetText(hNewNote, "FirstName", "Fred", MAXWORD);



ret = NSFNoteUpdate(hNewNote, 0);



ret = NSFNoteClose(hNewNote);

I’m rather new at Notes development so please let me know what other information I can provide.

Thanks,

Nicholas

Subject: RE: Use NIFOpenCollection()

Then I think you are basically out of luck I’m afraid. The C-API is primarily an interface on the the on-disk nsf.

There is no way that I know of, via this API, to ensure that clients that have that database open are notified. The code you have is fine.

Simon

Subject: RE: Use NIFOpenCollection()

Thanks, Simon. I was afraid of that, but it’s not a showstopper. Any possibility that it can be done through the client’s COM interface? Have been browsing through the exported symbols but haven’t stumbled upon anything just yet. Documentation is scarce.

Cheers,

Nicholas

Subject: RE: Use NIFOpenCollection()

You are not going to find a neat solution while your code is outside the Notes UI. The COM interface is backend classes only.

Maybe you could kludge something using OLE, even look at Notes/FX (!!! theres history for you). But it’s going to be ugly and horrid.

Put a lotusscript timer on the view that refreshes it every few seconds. Equally horrid (if it works at all)

Simon

Subject: RE: Use NIFOpenCollection()

Well too bad but thanks for the ideas! Much appreciated.

Nicholas