Working with Temporary Files

The Application object has several methods that you can use in your custom ADAM applications to deal with temporary files.

The GetTemporaryFolder method returns the path to the Temporary Files-folder of this user's session. Every time a user logs on in ADAM, an empty directory is automatically assigned to this user. In this directory you can store temporary files that are created for this user during this session. Storing your temporary files in this folder ensures that you will never have any conflicts with files created for other users.

The GetTemporaryFile(string extension) method returns the path to a non-existing file in the Temporary Files folder of this session. The file is not automatically created, but is guaranteed not to exist. The file returned will have the specified extension. The specified extension can, but does not have to, start with a dot.

The GetEmptyFolder method returns the path to a folder in the Temporary Files folder for this user which is guaranteed to be empty. This method is useful if you want to create temporary files with very specific filenames (like picture.jpg). Creating such files in a folder created by GetEmptyFolder ensures that you will never have any conflicts with other files of other users.

Any files created in folders returned by these methods are automatically cleaned up by ADAM.

Comments

Leave a comment
You must be logged in to post comments.
Sign in now
 
 
Technical
Business
rss feed