' This example demonstrates locking an element, but ' locking other CCVOBObjects works in a similar way. ' Connect to the top-level Rational ClearCase application object Dim CC As New ClearCase.Application Dim Elem As CCElement ' Get a CCElement object from the top-level application object Set Elem = CC.Element("m:\carol_main\caroltest\testelem.c") ' Create a lock on the element, but do not make the element obsolete. ' Exempt users "jo" and "caroly" from the lock Elem.CreateLock "locking from example script", False, Array("jo", "caroly") ' Print out some information about the lock ' Note: the example does no error checking, but you should check for errors! Dim ElemLock As CCLock Set ElemLock = Elem.Lock Dim Record As CCHistoryRecord Set Record = ElemLock.CreationRecord ' Get the list of exempt users Dim ExemptUsers as Variant Dim strUsers as String ExemptUsers = ElemLock.ExemptUsersStringArray For I = 0 To ElemLock.NumberOfExemptUsers - 1 If I <> 0 Then strUsers = strUsers & ", " & ExemptUsers(I) Else strUsers = ExemptUsers(I) End If Next I ' Print out other lock information MsgBox "Lock created by " & Record.UserLoginName & " at " & Record.Date & _ " and has " & ElemLock.NumberOfExemptUsers & " exempt users: " & strUsers ' Now change the list of exempt users, using a declared array rather ' than the Array() function Dim Arr(3) As String Arr(0) = "bill" Arr(1) = "eric" Arr(2) = "caroly" ElemLock.SetExemptUsersStringArray(Arr) ' Unlock it ElemLock.Remove