GetObjCurEditorId Script

Build 1501 on 14/Nov/2017  This topic last edited on: 7/Jan/2015, at 16:47

Description

Returns the ID of the user who's holding in use the specified object, or 0.

Syntax

dim UserId as Integer = UtilsBase.GetObjCurEditorId(iObjId, bMeIncluded)

iObjId

Id of the object you want to know who's using it

bmeIncluded

If True, it will return your ID as well, if you're the user of the object iObjId.; if False, it will return 0 if you're the user of the object iObjId.

Code

Public Shared Function GetObjCurEditorId(ByVal iObjId As Integer, ByVal bMeIncluded As Boolean) As Integer

  'returns the id the object's current user - possibly excluding the logged user (you)

  'v1 on 4/Dec/12 (BS)

  Dim objlist = New List(Of Integer)

  Dim userlist As List(Of Integer)

   objlist.Add(iObjId) ' txtlist.Add(article.GetTxtNode(iCurTxt).Id) - that would be for the current

   userlist = EditorialLogin.Get().ObjIsCheckedOut(objlist, CheckOutCode.Content)

  Dim userid = userlist(0)

  ' if nobody is using it, return ""

  If userid = 0 Then Return 0

  ' if you are excluded, and you're using it, return ""

  If Not bMeIncluded And userid = EditorialLogin.GetLogin.GetContext().UserId Then Return 0

  ' return specified attrib

  Return CInt(UtilsBase.GetObjAttrValue(userid, "id"))

End Function

See also

GetObjCurEditor Script

GetObjCurEditorName Script