Solved

Does Notes cache its NotesDocument COM objects?

Posted on 2007-03-23
6
365 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:jlalande
Comment Utility
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
Comment Utility
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
Comment Utility
It turns out that this is certainly correct and our solution works around this by recreating the session.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

11 Experts available now in Live!

Get 1:1 Help Now