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

Creating a new Object in VAF Using a Template Without Downloading The File

Hello!

I am aware of how to create new objects/documents using VAF without any issues but is there an easy way to indicate to use a specific template when creating a new document?

The idea here is when Object x reaches a certain state, we will create document y using a template.

Thank you, 

Mitch

Parents Reply Children
  • Sorry I wasn't very clear in my first question... Is there a way to do it without downloading the files? Would M-Files approve an application that downloads the files to a local location for a public cloud environment? I've already written code to do this using a downloaded file but was hoping to avoid downloading the file to work better in cloud environments.

    I have looked at the following:
    https://developer.m-files.com/Samples-And-Libraries/Samples/Processes/Copying-Objects/

  • The primary concern with files being "downloaded" in vault apps is them staying around after they've been finished with.  Your code should be written in such a way that any temporary files that are created are destroyed regardless of whether the code succeeds or fails.

    To be clear (I'm sure you know this, but just for the benefit of others): when I use the term "download" in the context of the vault application I mean to transfer the file out of the vault and into temporary storage on the M-Files server.

    Going back to your core point though: no, you will need to retrieve a copy of the file to subsequently use when you create the new object.  In the cloud you should use the temporary folder that .NET gives you access to (Path.GetTempPath()) for your files.  And, again, make sure your code is written in such a way that the files do not continue to reside on disk, even in error situations.