Solved

Does Notes cache its NotesDocument COM objects?

Posted on 2007-03-23
6
369 Views
Last Modified: 2013-11-17
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?
0
Comment
Question by:jlalande
  • 3
  • 3
6 Comments
 
LVL 18

Expert Comment

by:marilyng
ID: 18789239
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
 

Author Comment

by:jlalande
ID: 18802132
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
 
LVL 18

Expert Comment

by:marilyng
ID: 18803032
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:jlalande
ID: 18803160
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
 
LVL 18

Accepted Solution

by:
marilyng earned 500 total points
ID: 18810076
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
 

Author Comment

by:jlalande
ID: 18900333
It turns out that this is certainly correct and our solution works around this by recreating the session.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now