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

Export document to network folder using workflow

Is there a built method to export a document through a workflow step to a network folder? The application using the file does not support any API calls so the user access the secure folder through the application and manually imports.  We are hoping to use the history and workflow approvals to automatically export the file on the final step. 

Parents
  • There is no specific method for working with network folders, but you can use the DownloadFile Method.

    https://developer.m-files.com/APIs/COM-API/Reference/#MFilesAPI~VaultObjectFileOperations~DownloadFile.html

    The script is executed by the M-Files Server service which works with Local System Account.

    The trick is that on the file server you have to share the folder for the computer account of the machine running M-Files.

    ATTENTION!!! This may violate security policies, so use it carefully.

    The script that should work is something like this

    DownloadFolderPath = "\\name_or_IP_address_of_file_server\Download\"
    '--------------------------------------------------------------------------------
    'Download Object File 
    '--------------------------------------------------------------------------------
    
    Dim ObjectFileCollection: set ObjectFileCollection = Vault.ObjectFileOperations.GetFiles(ObjVer)
    
    Dim CurrentObjectFile: set CurrentObjectFile = ObjectFileCollection.Item(1)
    
    szExt = CurrentObjectFile.Extension 
    szTitle = CurrentObjectFile.Title
    
    Dim szFilePath : szFilePath = DownloadFolderPath & szTitle & "." & szExt
    
    'Download
    Vault.ObjectFileOperations.DownloadFile CurrentObjectFile.ID, CurrentObjectFile.Version, szFilePath

  • Thank you for the quick response.  I will work with this today to see if this resolves the issue for my user.  As for permissions, are you just running the M-Files services as a user with network privileges? 

Reply Children
No Data