×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Locking Document

Locking Document

Locking Document

(OP)
I have a document that can be opened and edited. I need help on how to lock this document if another users is updating or editing the document so that 2 users can not be in edit mode on the same document at the same time.

Thanks In Advance
BH2

RE: Locking Document

hey!  here is the "Help" document info on notesdocument.save (save method in NotesDocument Class) that allows you to not save if it's being edited.  Good luck!

flag = notesDocument.Save( force, createResponse [ , markRead ])
Parameters
force
Boolean. If True, the document is saved even if someone else edits and saves the document while the script is running. The last version of the document that was saved wins; the earlier version is discarded.
If False, and someone else edits the document while the script is running, the createResponse argument determines what happens.
createResponse
Boolean. If True, the current document becomes a response to the original document (this is what the replicator does when there's a replication conflict). If False, the save is canceled. If the force parameter is True, the createResponse parameter has no effect.

RE: Locking Document

I'm doing this form home so I can't give you any specific code examples but here's the general idea.

The best method I've found is to have your main doc create a lockdoc when it is put into edit mode. Prior to creating the lockdoc, in querymodechange, check for the existance of a lockdoc for the doc being edited (described below).  If it exists, pop up a message saying who is editing the doc, when did they start, etc. and cancel change to edit mode.

These lockdocs are stored in a sorted view by doc ID of the DOC BEING EDITED or some other unique feature.  The lock doc should also capture the user's name, time lockdoc went into edit and other relevant info.

When the user is done editing (eg; close event), have your script access the lockdoc view and delete the lockdoc.  If user's don't have delete permission in ACL, change the lockdoc form name to frmDelete or something like that and then run a daily agent to clean up all docs with form=frmDelete.

Another method is using a 'BeingEdited' field on the doc being edited but this does not work that well because you have to save the doc as soon as you set BeingEdited to yes.  Then if the user decides not to save the doc, you have to restore all field values and save it again.  Lots of unnecessary saves which messes up history fields, etc.

Hope this helps
YakUp

RE: Locking Document

Try http://www.xetrion.com.

They have a professional solution for document locking covering Notes/Web clients and server based agents.

Works fine in our environment.

Hope this will help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close