FileSystemTrigger.CreateFileSystemTriggerAsync
Description
Creates the File System Trigger with provided NewFileSystemTrigger instance from the connected Control Room. You can find the newly created File System Trigger in Control Room under the Automations\Triggers section.
Signature [C#]
Task<FileSystemTrigger> CreateFileSystemTriggerAsync(NewFileSystemTrigger newFileSystemTrigger)
Properties
Input
Property | Description |
---|---|
NewFileSystemTrigger | Details to create new filesystem trigger. |
Output
| Task<FileSystemTrigger> | Returns newly created filesystem trigger details. | |||
Remarks
Use CreateFileSystemTriggerAsync API to create a new FileSystem Trigger in the connected Control Room.
Example
C#
public void CreateFileSystemTrigger()
{
IControlRoomContext context = LoginControlRoom("RegularBuild", "BasicAuth");
NewFileSystemTrigger newFileSystemTrigger = new NewFileSystemTrigger()
{
Name = "FileSystemTrigger",
ProcessId = 1,
BotId = 1,
PathToMonitor = "C:\\Users\\Public",
IncludeSubfolder = true,
FileCreated = true,
FileModified = false,
FileDeleted = false,
FileRenamed = false,
LogLevel = "Information",
startDate = DateTime.UtcNow,
ExpiresOn = DateTime.UtcNow.AddDays(1)
};
FileSystemTrigger fileSystemTrigger = Task.Run(() => context.FileSystemTriggers.CreateFileSystemTriggerAsync(newFileSystemTrigger)).Result;
System.Console.WriteLine("FileSystem Trigger Name: " + fileSystemTrigger.Name);
}
C#
public IControlRoomContext LoginControlRoom()
{
IControlRoomContext context;
string connectionString;
connectionString = "ServerUrl=https://demo.onnitellibuddies.com;UserName=demoadmin;Password=password";
context = new ControlRoomContext(connectionString);
context.Open();
return context;
}