Hi All
I have a web Application in which if one user has edited a document, then no body should be able to edit that document. If some other users are editing the same then it will return a message.
I wrote a code like this.
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim db As NotesDatabase
Dim session As New NotesSession
Set db = session.CurrentDatabase
If uidoc.EditMode = True Then
uidoc.EditMode = False
Else
Print(“[” + db.filepath+“?EditDocument]”)
End If
But this is not working. Your help will be highly appriciated.
Or a piece of code to check the edit mode is also welcome.
thanks in advance.
Subject: Edit mode or not
This is very confusing.You say that this is a web application.
You can’t use any of the UI-classes in a web application.
Your code needs to be in a agent.
The link to the document must not be ‘?EditDocument’ by default.
You either build up the links to the documents so that they are either ‘OpenDocument’ or ‘?EditDocument’ depending on the contents of that Body field.
Or, you change all those links to point to an agent instead.
Like ‘myNewAgent?OpenAgent&unid=documentuniqueid’
Then, in the agent you check that Body field and return either a ‘?EditDocument’ or ‘?OpenDocument’ to the browser.
Subject: Use Authors fields
Use Author’s fields. They are specifically designed to meet your needs.
Messing with querymode change etc. is just a recipie for disaster as on the web it is very easy indeed to hack your way around it… like really really easy. So before you slide down the slippery slope, put an author’s field in there and feel the love.
hth
Adam.