Hello
Is there a way to automatically download files from m-files to a folder on the server when a specific workflow state is reached?
(We use M-files Desktop)
Hello
Is there a way to automatically download files from m-files to a folder on the server when a specific workflow state is reached?
(We use M-files Desktop)
Can be done in a script. Something like this should work
Option Explicit Dim objFiles Set objFiles = Vault.ObjectFileOperations.GetFiles(ObjVer) Dim intCount Dim intRemainingFilesCount : intRemainingFilesCount = objFiles.Count Dim szName, szID, szVersion, szPath For intCount = 1 To (intRemainingFilesCount) Set objFile = objFiles.Item(intCount) szName = objFile.GetNameForFileSystem() szID = objFile.ID szVersion = objFile.Version szPath = "E:\MFiles\Temp" & szName ' Target path, must be present on the M-Files server Vault.ObjectFileOperations.DownloadFile szID, szVersion, szPath Next
Can be done in a script. Something like this should work
Option Explicit Dim objFiles Set objFiles = Vault.ObjectFileOperations.GetFiles(ObjVer) Dim intCount Dim intRemainingFilesCount : intRemainingFilesCount = objFiles.Count Dim szName, szID, szVersion, szPath For intCount = 1 To (intRemainingFilesCount) Set objFile = objFiles.Item(intCount) szName = objFile.GetNameForFileSystem() szID = objFile.ID szVersion = objFile.Version szPath = "E:\MFiles\Temp" & szName ' Target path, must be present on the M-Files server Vault.ObjectFileOperations.DownloadFile szID, szVersion, szPath Next
Thank you, I will test it
Can you tell me how I can run a file using vbscript? I was able to save the files in the server folder and move them to another folder where users have access, but to do this I need to run a .bat file. Would it be possible to run this .bat file with vbscript?
Is it not possible to just change the path in the script so that the files are saved directly into the folder that users have access to?
If that folder is not on the same server you may need to make sure it is mapped as a network drive on the M-Files server.
Edit:
See this thread: RE: launch a command line from a workflow step
Have never used it myself, but may be worth a trial.
Also, I should note that scripting is being deprecated by Microsoft. You should not rely on scripts for the long run.
Thank you, let's test it
© 2024 M-Files, All Rights Reserved.