Ever misplace a file? Never? Well, almost never? OK, sometimes you can't find important files? The purpose of this tutorial is to check whether a specified file exists using a FileExists component and a Monitoring project.
Objectives: To create a project which displays the fundamental features of a Monitoring project.
Estimated time to complete: 30 minutes
Step 1: Create a New Project
To begin, create a new Monitoring project. The Monitoring project can be selected from the main page when you first run Workflow Designer.
Step 2: Setting Up Your Project
Begin setting up your project by dragging a FileExists component from your toolbox to your project's main model. The FileExists component is located under the Monitoring category of your toolbox.
Once added to your model, connect your FileExists component to your StartComponent and EndComponent as shown below:
In order for your project to function properly, it must have input variables specified. These variables dictate in what form the data for the project will be put in, and how it will be returned.
To setup your input variables, select the Input Data entry from the Project Info box on the left-hand side of your screen. Then, click the Add button once to create a variable:
Name the variable "InputFile" and set its type to "Text."
Return to your project's main model by selecting the Model: Primary tab at the top of the screen.
Step 3: Editing the FileExists Component
Right-click on your FileExists component and select Edit Component:
In the Edit Component window which appears, select the Setup tab.
Click the ... button to the right of the Path For Check field. In the window which appears, select the Variable Data (0) tab and click the Add button:
Select the variable "InputFile" (the input variable you specified) and click the OK button. Click the OK button again to return to the Edit Component window. Click the OK button in the Edit Component window to accept changes.
Step 4: Run and Test Your Project
Run your project by selecting the Debug icon from your toolbar. This icon appears as a bug with a green arrow over it.
In the window which appears, expand the MonitoringService.asmx link on the left-hand side. The blue Begin link will appear. Double-click on this Begin link.
Your project will ask you for an initial value for the input variable Input File:
Enter a file in the Input File entry. If you wish to test the functionality of the project fully, try entering a file you know exists, then re-run your project and try a file you know does not exist.
Once you have entered a file, click the OK button. Your project will begin executing.
When the project has completed running, it will display the path the project took:
In this example, the line from "File Not Found" is highlighted. Therefore, the project decided that "E:\MyFile.txt" did not exist on the computer's filesystem.