CreateDirectory Use Examples
Basic CreateDirectory Use
This is an example that we specify a path on application server and create the directory.
The log shows it runs successfully.
Then on the application server, you will see the directory created.
If the directory already exists, the service will return False.
Using CreateDirectory for Message Attachments
In this example, we examine a feature called the message center. Users with access (like an admin) have the ability to save messages and provide attachments. Then, certain users receive a notification that a new message exist and can be viewed. Upon viewing the message, the attachment is available to all users viewing the new message.
This is done by dynamically creating a directory based on the MessageId. Each time a message is created, it is first assigned a MessageId. Then, in order to add an attachment, the process puts together the file paths for the “Attachments” parent folder, the “MessageCenter” folder within that, and the “[MessageId]” folder within that (this one may not exist yet if the message is new). This is done in the “Paths” evaluate.
From there it checks if the directory for the MessageId exists. As mentioned, if the message is new, it won’t exist yet. This is where CreateDirectory is used. After finding the MessageId folder exists or creating it, the attachment is saved to that folder.
Here is the CreateDirectory configuration