Open topic with navigation

# Create Temporary Files

Your connector might need to create temporary files. The `task` objects have a `TempDirectory` property that provides the path of the directory to use for storing temporary files.

The `Temporary` class in the `Autonomy.Connector.Utilities` namespace provides a convenient method that you can use when creating temporary files:

           string tempFile = Temporary.File("TestDocument", ".doc");

This returns a unique path that can be used to store a temporary file. The method is passed two arguments, a prefix and an extension. The file name generated by the example begins with “TestDocument” and ends with the “.doc” extension. The middle of the file name is generated automatically to ensure the file name is unique.

Using this method has the following advantages:

- It always generates a unique file name – even in situations where different running tasks are using the same temporary directory.
- It always uses the temporary directory configured in the connector's configuration file.
- The file extension can be preserved.
- A human readable prefix can be used which can be useful when debugging a connector.

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm