The following example reads the values of office locations from a text file using a dynamic plugin variable.


  • A list of departments is stored in a text file c:\data\departments.txt



  • The XIA Service Account has access to the file c:\data\departments.txt

  • The following using statement is added to the code

    using System.IO;


  • The following code is used to read the contents of the departments.txt file and add them to the Values collection.


using System;

using CENTREL.XIA.Automation.Model;

using CENTREL.XIA.Automation.Server;

using CENTREL.XIA.Automation.Support.Diagnostics;

using System.IO;


/// <summary>

/// This is a dynamic variable plugin that provides options that the user may select from.

/// </summary>

public class DynamicVariablePlugin : DynamicPluginVariableBase

{


    /// <summary>

    /// Enter the custom code within the execute method.

       /// The values displayed to the user are stored in the "Values" property.

    /// </summary>

    public override void Execute()

    {

   string[] departments = File.ReadAllLines(@"c:\data\departments.txt");

   foreach (string department in departments)

          {

 Values.Add(department);

   }

    }


}