M-Files API 23.11.13135.0
GetObjectClass Method
VaultClassOperations Object : GetObjectClass Method
The class ID of the class to retrieve.
Description
Gets a single object class.
Syntax
Visual Basic
Public Function GetObjectClass( _
   ByVal ObjectClass As Long _
) As ObjectClass
Parameters
ObjectClass
The class ID of the class to retrieve.
Example
' Identify the object.
Dim oObjVer As MFilesAPI.ObjVer
'...

' Get the value of class property.
Dim oPropertyValues As MFilesAPI.PropertyValues = oVault.ObjectPropertyOperations.GetProperties(oObjVer)
Dim oPropertyValue As MFilesAPI.PropertyValue = oPropertyValues.SearchForProperty( _
    MFilesAPI.MFBuiltInPropertyDef.MFBuiltInPropertyDefClass)

' As this is class property, the data type is always "Lookup value".
If oPropertyValue.TypedValue.DataType <> MFilesAPI.MFDataType.MFDatatypeLookup Then
    Throw New SystemException("Internal error")
End If

' The value of lookup item is the class id. Resolve the class object.
Dim iClassId As Integer = oPropertyValue.TypedValue.GetLookupID()
Dim oObjectClass As MFilesAPI.ObjectClass = oVault.ClassOperations.GetObjectClass(iClassId)

' Resolve the class name.
Dim szClassName As String = oObjectClass.Name
See Also

VaultClassOperations Object  | VaultClassOperations Members