VBScript - Get latest value from text property on existing Metadata Card

Hi All,

In a workflow state, I need to retreive a value from a property (text) that is on a pre-existing metadata card. (latest version)

I have found a way to do this using the REST api, but I cannot translate this into a COM api solution. (There might be a better way, but I'm still new to these API's)

Through the REST API, I can do the following:

GET Request :"http://<mfilessite>/REST/objects.aspx?p1062"  (Where p1062 is the property (text) on the metadatcard.)

From this object I can obtain

ObjVer = {Version=165; VersionType=4; ID=39; Type=109}

Then using these values I can call the following

GET Request : http://<mfilessite>/REST/objects/109/39/165/properties/1062.aspx"

This object contains the the value of the property I require.

I would like to be able to complete the following using the COM API, however I have only been able to find the ObjVer. This is where I get stuck.

Below is what I have so far. 

Option Explicit

Dim oSC, oSCs

Set oSC = CreateObject("MFilesAPI.SearchCondition")
Set oSCs = CreateObject("MFilesAPI.SearchConditions")

oSC.Expression.SetPropertyValueExpression 1062, MFParentChildBehavior.MFParentChildBehaviorNone , Null
oSC.ConditionType = MFConditionTypeNotEqual
oSC.TypedValue.SetValueToNULL MFDataTypeMultiSelectLookup
oSCs.Add -1, oSC

oSC.Expression.DataStatusValueType = MFStatusTypeDeleted
oSC.ConditionType = MFConditionTypeEqual
oSC.TypedValue.SetValue MFDataTypeBoolean, False
oSCs.Add -1, oSC

Dim oSearchResults
Set oSearchResults = Vault.ObjectSearchOperations.SearchForObjectsByConditions(oSCs, MFSearchFlagNone, False)

'BELOW IS FOR TESTING ONLY. I ASSUME I WOULD USE A FOR LOOP HERE?

If oSearchResults.Count >= 1 Then
Err.Raise MFScriptCancel, "Found Result(s)" + oSearchResults.Item(1).Title
Else
Err.Raise MFScriptCancel, "Nothing Found"
End If

Any help on this  would be greatly appreciated.

Parents Reply Children