Does Notes cache its NotesDocument COM objects?

I am using the Notes COM toolkit to do contact lookups.  The issue I am having is that if I make a change to a contact in Notes (edit a phone number, etc), then retrieve the updated NotesDocument, the updates are not present.

Does Notes cache these objects?  And if so, is there a way to force the NotesDocument to refresh itself?
jlalandeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

marilyngCommented:
Apologies if this is a stupid question, but can you clarify what you mean by Notes COM toolkit?  Are you writing an external program using Visual Studio, C, etc. that is opening  the names.nsf database on a local client or server? (which one).

Are you using the COM objects to search through a view to grab a document, and are you accessign that document directly, or are you using the view column to get the results.

Reason I ask is stepping through a view, and getting view column results might be delayed for a number of reasons:  The public directory, names.nsf, is usually replicated to many servers, and the view indexes may not be immediately refreshed.  However, document changes should be current.

The same may hold true for the contacts residing in the pernames.nsf (local address book).  The document may be updated immediately, but the view index may be delayed.

That being said, front end changes to a Notes document are usually refreshed when saved.   Commands like, @DBLookup, use a Cache/NoCache option, when searching for values.  If invoked, then the lookup will cache the results to avoid searching for newer items.

It really depends on what commands you are using.   I found if I don't destroy variables and recreate them, then the external program will cache old values.  It might help if you post a bit of code. :)
0
jlalandeAuthor Commented:
The Lotus Notes COM Toolkit is simply another toolkit that IBM provides for custom integration with Notes.  However, it is no longer available nor supported.  We are currently using the C Toolkit for new development, but still have key portions of code dependent on the COM Toolkit.

Our development is in C#, but the following VBScript shows what we are doing:

set session = CreateObject("Lotus.NotesSession.7.0")
session.Initialize
set db = session.GetDatabase("", "C:\Program Files\lotus\notes\data\Names.nsf", true)
if not db.IsOpen then
  db.Open
end if
set doc = db.GetDocumentByUNID("5F76B8E5528B01B1862572AA005E0B33")
itemList = doc.GetItemValue("OfficePhoneNumber")
WScript.Echo(itemList(0))
set doc = db.GetDocumentByUNID("5F76B8E5528B01B1862572AA005E0B33")
itemList = doc.GetItemValue("OfficePhoneNumber")
WScript.Echo(itemList(0))

A test contact is created that has a UNID of "5F76B8E5528B01B1862572AA005E0B33".  The UNID cannot be set; I had to write another script to extract this value.  If the script is run from Explorer (double-click), a message box displaying the office phone number.  While the message is displayed, I can return to Notes, update the office phone and save the change.  If I return to the message, click OK, the NotesDocument is refetched but the office phone does not show the change.

I have tried refetching the database as well with no change.  Re-initializing the NotesSession object does work, however, I am concerned about the cost.  But it looks like there's no other way.
0
marilyngCommented:
So, when you destroy the session, the program releases its handles and cached information?  What we normally do at the end of the script is destroy the handles, like doc, so it doesn't cache and return the previous value.   Question, are you declaring the variables?  (Early vs. late binding?)

A thought, the local client might cache more than the server.  I would have to try this to see if it does.  Generally, I've never had to hit a local client for data.  I usually stick to hitting the server, which is probably why I haven't run into this.  Mayne one of the more savvy C experts will pitch in. :)

Will try and get back to you.

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

jlalandeAuthor Commented:
Yes, recreating the session object gets the updated data.  It looks like we may have to do this for our solution.  We are testing this now.

Apparently, the approach used where the session is instantiated and used throughout the application session is not the correct approach.
0
marilyngCommented:
It would seem that the session is caching and binding.  On a local client, this should not be too performance intensive provided that you destroy variables when you are finished with them and close the session.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jlalandeAuthor Commented:
It turns out that this is certainly correct and our solution works around this by recreating the session.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.