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 (https://kb.cloudvault.m-files.com/Default.aspx?#3ECA226F-7B54-428B-B539-DE443E6134EC/object/BE2AA2E4-8B75-43DF-8E31-C045A31938B0/latest) 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.


1. 
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
preout=EL.Text
output = preout ' Output contains base64 encoded serialized typed value. 
----------------------------------

2.
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

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Help Desk Software by Kayako case