Hello,
Yes, it is possible. However, it cannot be done using value references in built-in actions if both actions (script and Exchange properties modification) are performed in the same workflow (e.g. in a single Business Rule). It is because value references are resolved before executing a Business Rule, Custom Command or Scheduled Task. As such, the value reference %adm-CustomAttributeText40% will resolve into an empty value. To achieve the desired, you can use a Scheduled Task like the following to save the domain part of user emails into the custom attribute:
Then, you can use a Custom Command or a Scheduled Task to set the OOF message the way you referenced. To check whether the feature is enabled, use the below script in the If PowerShell script returns true condition. The condition will be met if the feature is disabled completely or OOF messages are scheduled for the period that does not include the current date.
# Get mailbox parameters
$Context.ConditionIsMet = $False
try
{
$mailboxParams = $Context.TargetObject.GetMailParameters()
}
catch
{
return
}
# Check OOF configuration
$automaticReplies = $mailboxParams.AutoReplyConfiguration
$automaticRepliesStatus = $automaticReplies.AutoReplyState
switch ($automaticRepliesStatus)
{
"ADM_EXCHANGE_OOFSTATETYPE_DISABLED"
{
$isEnabled = $False
}
"ADM_EXCHANGE_OOFSTATETYPE_ENABLED"
{
$isEnabled = $True
}
"ADM_EXCHANGE_OOFSTATETYPE_SCHEDULED"
{
# OOF message is scheduled
# Check whether OOF is enabled right now
# Get current date
$currentDate = Get-Date
# Check OOF schedule
$startDate = $automaticReplies.StartTime
$endDate = $automaticReplies.EndTime
if (($startDate -lt $currentDate) -and ($endDate -gt $currentDate))
{
$isEnabled = $True
}
else
{
$isEnabled = $False
}
}
}
$Context.ConditionIsMet = !$isEnabled
Finally, you will have something like the following: