0 votes

Here is what i want to do:

  • check if the user has an OOF-Message set, when not, then we set such a message.

many of our users have several e-mailadresses in their e-mail field. and what i want to do is, to set individually OOF-Messages...

so i want to get the e-mail domain from the e-mail field of the user and store it to a customattribute

image.png

and then the oof-message should look like: image.png

is this possible?

by (200 points)

1 Answer

0 votes
by (272k points)

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: image.png 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: image.png

0

ok thank you for the information.

and is there another possability, for example to only get the domain from the UPN

image.png

best regards

0

Hello,

Sure, you can use the very same script to get the domain part of the UPN property.

Related questions

0 votes
1 answer

Our adaxes service account is able to create the mailbox when running our create user business rule, but cannot change any settings like disable OWA. What level of security will it need?

asked Apr 6, 2021 by bstone (50 points)
0 votes
1 answer

I would like to create a task to get an address from proxyAddresses (Email Proxy Addresses) and add the number to a CustomAttribute field. The address would be DIR:xxxx ... digit number) and I would like to add the 4 digit number to adm-CustomAttributeText5.

asked May 6, 2016 by Kikaida (1.1k points)
0 votes
0 answers

I know Adaxes has a module in it that uses e-mail verification in the password self-service policies. Can the verification system be used for anything other than an AD password ... to have a custom task run, but only after e-mail or text verification? Thanks!

asked Jul 27, 2015 by rlemaster (20 points)
0 votes
1 answer

Hello, Some users we are trying to cross over into Adaxes have e-mail addresses with plus signs. Right now, if they put an e-mail address of, "Eamun+hello@domain.com" it ... plus signs in e-mail addresses? I should be valid. http://tools.ietf.org/html/rfc5233

asked Dec 17, 2013 by Eamun (70 points)
0 votes
2 answers

I am trying to create a report-specific column (DateTime - Regular Date) where I can extract the datetime from the description field of the user object using a regular ... () $line = $object.Get("description") $dateTime = ?? $Context.Value = $dateTime

asked Feb 27 by emeisner (60 points)
3,350 questions
3,051 answers
7,791 comments
545,067 users