I’m currently trying to use the document locking functionality in Notes through ole automation from another application. But I believe there is a bug in Notes and was wondering if anyone else has seen the same problem?? I do the following, which still causes a message dialog to appear in the Notes client telling the user the document is locked by another user and then hangs. This all happens even though in my EditDocument I set the first parameter to False to not open in edit mode and the third parameter to True to open in Read-Only mode. Is there something I’m missing or doing wrong. The message appears in Notes after the EditDocument is called, so not related to getting the initial document reference for checking for locked users… After I select ok on the message an exception is raised from notes as well, but it is a generic exception and at this time it just hangs. Here’s an example of my source…
NotesUI:=CreateOleObject('Notes.NotesUIWorkspace');
NotesUI.OpenDatabase(local_NotesServer,local_NotesDB);
NotesDoc := NotesUI.CurrentDatabase.Database.GetDocumentbyUNID(local_NotesUDocID);
if NotesUI.CurrentDatabase.Database.IsDocumentLockingEnabled then begin
//get list of lock holders and first holder is blank if no locks
oleList := global_NotesDoc.LockHolders;
if (VarIsArray(oleList)) and
(not (VarIsEmpty(oleList))) and
(oleList[0]<>'') then begin
sLogMsg:='This document is currently locked by: ';
for iLockee:=VarArrayLowBound(oleList,1) to VarArrayHighBound(oleList,1) do begin
sLogMsg:=sLogMsg+oleList[iLockee]+',';
end;
//Ask to open document in read-only mode.
if MessageDlg( sLogMsg, mtConfirmation,[mbYes, mbNo],-1)=mrYes then
bReadOnly:=True
else begin
exit; //Exit..
end; //if MessageDlg
end; //if DocLockHolders
end; //if Locking Enabled
if (bReadOnly) then
global_NotesUI.EditDocument(FALSE,global_NotesDoc,TRUE,'',FALSE,TRUE)
else
global_NotesUI.EditDocument(FALSE,global_NotesDoc);
**At this point the Notes dialog appears and says that the document is locked by another user.
Select ok and a general exception is raised back to my application, which is handled, but the
Notes client is in a semi-not responding mode. (You can't shutdown Notes without using end process.)
The document is visible in Notes and I can use the cursor which is set to the "processing" icon to select
a radio button if in edit mode and if in read-only I cannot select the radio button. So it appears to
have worked somewhat, but still checks the locking even if opening in read-only.
to have opened with the right parameters as I cannot select a radio button