The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Increase Document version value

Hello, 

could anybody be so kind and could help me with this little issue? I need to write a little script which should increase the number of document version by one. But I am getting error: Obejct required: [string: "1"]  for row: Dim oVersion: Set oVersion = PropertyValues.SearchForProperty( iPDVersion ).TypedValue.DisplayValue

What am I doing wrong here? 

My code:

Dim iPDVersion: iPDVersion = Vault.PropertyDefOperations.GetPropertyDefIDByAlias("PD.Version")
Dim oVersion: Set oVersion = PropertyValues.SearchForProperty( iPDVersion ).TypedValue.DisplayValue


Dim oPropValNew: Set oPropValNew = CreateObject("MFilesAPI.PropertyValue")
Dim oPropValsNew: Set oPropValsNew = CreateObject("MFilesAPI.PropertyValues")

oPropValNew.PropertyDef = iPDVersion
oPropValNew.TypedValue.SetValue, oVersion + 1

oPropValsNew.Add -1, oPropValNew


Thank you! 

Parents Reply Children