I've been beating my head against a wall trying to figure out how to lock a document, so only one person can modify it at any one time.
I'm not useing any replicas, so I don't have to worry about a replica copy being modified.
I did come up with a way to lock the doc. But there's a hitch to it - my method doesn't give them any way of canceling changes!
Here's what I did- in the QueryModeChange, I check to see if they're currently in Read mode, and if they are (I know they're querying to enter Edit Mode), I set a flag in the NotesDocument, and save it.
On the other-hand, if the flag's already set by someone else, I set Continue to false so that they can't enter edit mode.
In the QueryClose event, I delete the flag.
This is fine. But the hairy part comes when a user wants to cancel any changes they made. I can't delete the flag in the document, and save the document, without saving the changes that were made to the NotesUIDocument. The SaveOptions field has no relivance if I perform a save on the NotesDocument itself, and even if it did, I wouldn't want it to NOT save the change of the flag.
The only possiblity I can think of for reverting back to the original values is to create a 2 element array in the General Declarations, enumerate through the NotesItems in the document, and store all Names and Values- then, on a Cancel, set all items to the values I stored in the arrays.
I can't find a single property anywhere, for NotesDocuments, that says whether or not it's opened by someone else. If I could, I could avoid this stupid flag in the first place.
Is there a simple solution, so that I don't have to write all the code for enumerating through the document? Can I cancel, or Undo changes to each Item in the UIDoc?
Thanks
-MoGryph
[8O)
I'm not useing any replicas, so I don't have to worry about a replica copy being modified.
I did come up with a way to lock the doc. But there's a hitch to it - my method doesn't give them any way of canceling changes!
Here's what I did- in the QueryModeChange, I check to see if they're currently in Read mode, and if they are (I know they're querying to enter Edit Mode), I set a flag in the NotesDocument, and save it.
On the other-hand, if the flag's already set by someone else, I set Continue to false so that they can't enter edit mode.
In the QueryClose event, I delete the flag.
This is fine. But the hairy part comes when a user wants to cancel any changes they made. I can't delete the flag in the document, and save the document, without saving the changes that were made to the NotesUIDocument. The SaveOptions field has no relivance if I perform a save on the NotesDocument itself, and even if it did, I wouldn't want it to NOT save the change of the flag.
The only possiblity I can think of for reverting back to the original values is to create a 2 element array in the General Declarations, enumerate through the NotesItems in the document, and store all Names and Values- then, on a Cancel, set all items to the values I stored in the arrays.
I can't find a single property anywhere, for NotesDocuments, that says whether or not it's opened by someone else. If I could, I could avoid this stupid flag in the first place.
Is there a simple solution, so that I don't have to write all the code for enumerating through the document? Can I cancel, or Undo changes to each Item in the UIDoc?
Thanks
-MoGryph
[8O)