Solved

Does Notes cache its NotesDocument COM objects?

Posted on 2007-03-23
6
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 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