Domino 9 und frühere Versionen > Entwicklung

OLE

(1/3) > >>

mgeidl:
Hallo Notes-Gemeinde!

Wir haben in unserem Konzern eine Doku-DB, die auf 3 Servern repliziert wird.
In einigen Dokumenten müssen die SAP-Programmierer immer ihren Senf dazugeben, d.h., sie lösen den Anhang, ändern und hängen wieder neu an. Nun hab ich mir gedacht, wäre es besser, mit einem Objekt zu arbeiten.

Gibt es da eine Möglichkeit, daß Überprüft wird, ob dieses Objekt schon von einem anderen bearbeitet wird, bzw. ob das Notes-Dokument schon von irgendwem bearbeitet wird?

Daß es bei der Replizierung dann trotzdem zu Speicherkonflikten kommen kann, ist mir schon klar.

Danke schon mal für Eure Hilfe.

Marietta

Axel:
Hi,

für eine Überprüfung ob ein Objekt bearbeitet wird sehe ich wenig Chancen.

Das hier hab ich mal im Internet gefunden:


--- Zitat ---Locking documents to prevent save conflicts

This piece of code assigns edit lock to the first user who opens the document. When other users try to open the same document, they get a message saying "Document is locked by X" and a read-only copy is opened for them. They will not be able to edit the document until the lock is released by the first user.

A manually run agent to unlock the document can be provided for Domino Admin in case of system crash.

Form should have a hidden field called "Lock" of type Text (Editable)
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
       If (Source.IsNewDoc) Then
              Exit Sub
       End If   'New Doc, Lock not reqd
       Dim varLock As Variant
       Dim session As New NotesSession
       Dim nnUserName As New NotesName(session.UserName)
       Set docBackend=Source.document
       varLock=docBackend.GetItemValue("Lock")
       If (varLock(0) <> "") Then
              Msgbox ("Document is currently locked by "+varLock(0)+". A read-only copy will be opened for your use.")
              Exit Sub
       End If
       docBackend.Lock=nnUserName.Common
       Call docBackend.Save(True,True)
End Sub

'When user trys to edit, check if he/she has the lock

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
       If Source.FieldGetText("Lock")<>"" Then
              Dim session As New NotesSession
              Dim nnUserName As New NotesName(session.UserName)
              If (Strcomp(nnUserName.Common,Source.FieldGetText("Lock"),5)=0) Then
                     continue=True
              Else
                     Msgbox("Sorry, you are in read-only mode ! This operation cannot be performed. This document is currently used by "+Source.FieldGetText("Lock"))
                     continue=False
              End If
       End If
End Sub

'Release the lock when the user with the lock closes the document

Sub Queryclose(Source As Notesuidocument, Continue As Variant)
       If strNewDoc="New" Then  '(exit if it's a new doc.Set this variable to New in postopen if it's a new doc)
              Exit Sub
       End If
      
       Dim session As New NotesSession
       Dim nnUserName As New NotesName(session.UserName)
       If (Strcomp(nnUserName.Common,Source.FieldGetText("Lock"),5)=0) Then
              Set docBackend=Source.document
              docBackend.Lock=""
              Call docBackend.Save(True, True)
       End If
      
End Sub

Agent to Unlock selected documents -
Manually run agent - Simple Action
Modify field 'Lock': Set to ''

--- Ende Zitat ---

Damit verhindert man, dass ein zweiter User das Dokument bearbeiten kann. Vielleicht hift dir das weiter.


Axel

mgeidl:
Hoch soll er leben, hoch soll er leben, .......

Schönen Feiertag.

Marietta

Axel:
Hi,

danke für die Blumen.  ;D


Auch einen schönen Feiertag.


Axel

Woschi:
...funktioniert der QuellCode auch unter Domino 6.5?

Ich möchte ganz gerne ohne die standard Lock-Funktion arbeiten, aber bekomme beim öffnen des Dokuments folgende Fehlermeldung:

"Wrong number of arguments for methode"

Im debugger hängt er sich am Punkt

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
If (Source.IsNewDoc) Then
Exit Sub
End If 'New Doc, Lock not reqd
Dim varLock As Variant
Dim session As New NotesSession
Dim nnUserName As New NotesName(session.UserName)
Set docBackend=Source.document
varLock=docBackend.GetItemValue("Lock")
If (varLock(0) <> "") Then
Msgbox ("Document is currently locked by "+varLock(0)+". A read-only copy will be opened for your use.")
Exit Sub
End If
docBackend.Lock=nnUserName.Common
Call docBackend.Save(True,True)
End Sub

auf.

Meine Scriptkenntnisse haben etwas gelitten die letzten Jahre, aber scheinbar hat sich hier im Laufe der Versionsupdates einiges verändert, oder irre ich mich?

Auch wenn der Eintrag hier schon recht alt ist, hoffe ich doch sehr, daß ihn jemand ließt und mir weiterhelfen kann  ???

Gruß
Woschi

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln