Is form open by another user?

  • Thread starter Thread starter Rayyan Sultani
  • Start date Start date
R

Rayyan Sultani

Is there an easy way to check by code if a custom post form is open by
another user and if yes then do not allow edit or take some action?
Rayyan
 
The sample code in the message will look something like
this :
- I added a custom property to the public folder, called
UserLockText which has a default value of "Not Set"

simple code VbScript

Function Item_Open()
msgbox item.UserProperties("UserLockText").Value
Set myNameSpace = Application.GetNameSpace("MAPI")
MsgBox myNameSpace.CurrentUser.Name
If Item.UserProperties("UserLockText").Value <> "False"
and Item.UserProperties("UserLockText").Value <> "No set"
Then
msgbox "Questo Messaggio e' aperto da: " &
item.UserProperties("UserLockText").Value
Item_Open = False
Else
If Item.UserProperties("UserLockText").Value = "False"
then
Item.UserProperties("UserLockText").Value =
myNameSpace.CurrentUser.Name
msgbox item.UserProperties
("UserLockText").Value
Item.Save 'for lock the open item
End If
End If
End Function


Function Item_Close()
Const olSave = 0
' Msgbox Item.UserProperties("UserLockText").Value
Item.UserProperties("UserLockText").Value = "False"
Item.Close olSave
End Function
 
Back
Top