In the following example, there is a business requirement that mailboxes be created across multiple mailbox stores.


  • The Exchange mailbox store is determined by the name of the user that has been created

    • Users with usernames that start with letters A-G are stored in "Store1"
    • Users with usernames that start with letters H-N are stored in "Store2"
    • Users with usernames that start with letters O-Z are stored in "Store3"

  • The user's username has been stored in an output variable named [Username].

  • The Mailbox Enable Task is configured with a mailbox store using the variable [MailboxStore]


using System;

using CENTREL.XIA.Automation.Agents;

using CENTREL.XIA.Automation.Model;

using CENTREL.XIA.Automation.Support.Diagnostics;

using System.Text.RegularExpressions;


/// <summary>

/// Determines the name of the Exchange mailbox store.

/// </summary>

public class CustomPlugin : PluginBase

{


    /// <summary>

    /// Implements the name of this custom plugin

    /// </summary>

    public override string Name

    {

        get { return "Determine Exchange Mailbox Store"; }

    }



    /// <summary>

    /// Determines the name of the Exchange mailbox store based on the user's name.

    /// </summary>

    public override void Execute()

    {

        string FirstLetter = Variables.FindByName("Username").ValueString.Substring(0,1);

        if (Regex.IsMatch(FirstLetter, "[A-G]")) { Variables.FindByName("MailboxStore").Value = "Store1"; }

        if (Regex.IsMatch(FirstLetter, "[H-N]")) { Variables.FindByName("MailboxStore").Value = "Store2"; }

        if (Regex.IsMatch(FirstLetter, "[O-Z]")) { Variables.FindByName("MailboxStore").Value = "Store3"; }

    }


}