Connect with us and enhance your M-Files experience using Extension Kit for M-Files. Here’s how to get started.
Dear Community,
Currently we are using a script along with a value list of disallowed file extension (see below).
I would like to replace this script with an EK validation rule.
My question now is, which property can I use to filter for the file extension .
The Property Filname unfortunately does not contain the file extension.
Does anyone here have an idea of what could be used?
Thanks in advance for your ideas
Kind regards,
Jeremias
Option Explicit Dim iForbiddenExtensionListID, oListForbiddenExtensions Dim oFiles, oFile, oForbiddenExtension Set oFiles = Vault.ObjectFileOperations.GetFiles(ObjVer) iForbiddenExtensionListID = Vault.ValueListOperations.GetValueListIDByAlias("list.VerboteneDateiendungFuerUpload") Set oListForbiddenExtensions = Vault.ValueListItemOperations.GetValueListItems(iForbiddenExtensionListID) If oFiles.Count > 0 Then For Each oFile in oFiles For Each oForbiddenExtension in oListForbiddenExtensions If lcase(oFile.Extension) = lcase(oForbiddenExtension.Name) Then Err.Raise MFScriptCancel, "Upload der Datei '" & oFile.Title & "." & oFile.Extension & " nicht möglich." & vbCrlf & _ "Der Upload von Dateien mit der Dateiendung ." & oFile.Extension & " ist verboten." End If Next Next End If
Hi @jerry,
Instead of using script, you can achieve this by adding an Extended Auto Property rule where you use <<EXTENSION(‘*’)>> to save the extension of your file to a new property:
Then, set up Validation rules to check whether any of the extensions are on your disallowed list. Currently, <<EXTENSION(‘*’)>> works only with single-file objects, not multi-file ones. Still, I hope this works for you. Let me know if you need any further assistance.
Best regards,
Nika
So, you came to the end of the page. This means you are passionate about technology as we are.
WATCH THE WEBINAR