Is form open by another user?

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
 
V

Vittorio Lupi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top