Frequently Asked Questions
Frequently Asked Questions
How to make encoded value for URL property?
Posted by Hannu Anttila (M-Files) on 25 March 2019 03:09 PM

M-Files URL properties document ( instructs to use base64-encoded string for other property types than text, multi-line text, integer or boolean.

This article gives an example how to calculate that value.

You have to calculate the encoded value from Typed Value of the property. So a simple script is needed:
- Make a new property, e.g. "Serialize property", Data type must be "Text (multi-line)"
- Put the following script in Calculated value (VBScript)"
- Change the property value in the script to point to the correct ID (in this example 1229), which is the ID of the property which value you want to get:
Dim sMatterName, oDocPropVals
Set oDocPropVals = CreateObject("MFilesApi.PropertyValues")
Set oDocPropVals = Vault.ObjectPropertyOperations.GetProperties(ObjVer)
sMatterName = oDocPropVals.SearchForProperty(1229).TypedValue.Serialize() ' should be id of corresponding property e.g. 1229

' Encode the Matter Name in base64
dim DM, EL,preout
Set DM = CreateObject("Microsoft.XMLDOM")
' Create temporary node with Base64 data type
Set EL = DM.createElement("tmp")
EL.DataType = "bin.base64"
' Set bytes, get encoded String
EL.NodeTypedValue = sMatterName
output = preout ' Output contains base64 encoded serialized typed value. 

Then goto object's metata in M-Files desktop, which uses the property whose encoded value you want to have, and place this serialize property there and save. 
You can then see the value to be used e.g. in URL searches after saving the object.

So in this example the search is: m-files://search/Sample Vault?propertyvalue=1229/-/AQAAAAUAAAAA4QcCAAkA
Here property ID is 1229 and the search finds objects where "Approval date"=9.2.2017


(0 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako case