0 votes

Hello,

i have a custom command which sets the oof-message for the selected user. in this custom command i have a parameter "param-vertretung" (ad-object picker). Now i want to put the fullname, phone number and email from "param-vertretung" into the oof-message.

we want our users to select another user as a stand-in and then display the fullname, phone number and email of the stand-in in the oof-message. Can you help me with that? Thanks

by (100 points)
0

Hello,

Sorry for the confusion, but we are not sure we understand what exactly you need to achieve. Is it that you want to select multiple users in the Ad object picker parameter, get their property values (Full name, Phone number and Email) and add the values to the OOF message of the user? If that is correct, it can be done using a script that will get the values and use them to set the OOF message. For us to provide you with the script, please, specify what exactly the script should do. Should it only update the OOF message or also enable/schedule the feature?

If that is not what you need, please, describe the desired behavior in all the possible details with live examples.

0

Hello, thanks for the quick answer. i want the object picker to select only one user, and then put the property values of this user in the oof message. the scheduling of the message with date and time is also needed.

Example: User A will go on vacation. User A selects User B as a stand-in. User A chooses the beginning and ending of the oof message. in the oof message are the contact details (Full Name, Phone Number, Email) of the stand-in User B.

0

Hello,

User A selects User B as a stand-in. User A chooses the beginning and ending of the oof message. in the oof message are the contact details (Full Name, Phone Number, Email) of the stand-in User B.

Thank you for clarifying. What exactly do you mean by chooses the beginning and ending of the OOF message? Are they also specified via parameters? Could you, please, provide us with all the parameters that will take part in setting OOF message and how each of them should be used? A screenshot of the Custom Command parameters list will be very helpful. You can post it here or send to us (support[at]adaxes.com).

the scheduling of the message with date and time is also needed

How will the start date and end date be specified? Will it also be done via parameters?

0

image.png

This are the parameters in the custom command. param-Vertretung = Stand-in param-abw-beginn= start for oof message param-abw-ende= end of oof message

0

Hello,

Thank you for the provided details. Could you, also, please, specify what should be done if the user selected in the Vertretung parameter has no Phone Number or Email? Should the update be cancelled or the values should just be ignored during OOF enabling?

0

Hello,

the values should just be ignored, if the selected user has no Email or Phone Number. This would be just fine. Thanks.

1 Answer

0 votes
by (223k points)

Hello,

Thank you for the provided details. Your Custom command should look like the following: image.png In the command, use the below script. In the script:

  • $phoneNumberPropertyName - Specifies the LDAP name of the property that will be used to obtain the mobile number of the user specified in the parameter.
  • $userParameterName - Specifies the name of the parameter for selecting a user with the param- prefix.
  • $oofStartDateParameterName - Specifies the name of the parameter for selecting the OOF schedule start date with the param- prefix.
  • $oofEndDateParameterName - Specifies the name of the parameter for selecting the OOF schedule end date with the param- prefix.
  • $oofMessageTemplate - Specifies a template of the OOF message that will be set. In the template, placeholders {0}, {1}, {2} and {3} will be replaced with the OOF schedule end date, full name, phone number and email address of the selected user accordingly.
$phoneNumberPropertyName = "telephoneNumber" # TODO: modify me
$userParameterName = "param-Vertretung" # TODO: modify me
$oofStartDateParameterName = "param-abw-beginn" # TODO: modify me
$oofEndDateParameterName = "param-abw-ende" # TODO: modify me
$oofMessageTemplate = "I am on vacation until {0} 
and will not see your message until then. 
Your message sits safely in my Inbox awaiting my return.
If you need immediate assistance, please contact {1} at {2} {3}." # TODO: modify me

# Bind to the source user
$userDN = $Context.GetParameterValue($userParameterName)
$user = $Context.BindToObjectByDN($userDN)

# Get source user full name
$fullName = $user.Get("cn")

# Get source user phone number
try
{
    $phoneNumber = $user.Get($phoneNumberPropertyName)
}
catch
{
    $phoneNumber = $NULL
}

# Get source user email
try
{
    $email = $user.Get("mail")
}
catch
{
    $email = $NULL
}

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Schedule OOF
$automaticReplies = $mailboxParams.AutoReplyConfiguration
$automaticReplies.AutoReplyState = "ADM_EXCHANGE_OOFSTATETYPE_SCHEDULED"

$startTime = $Context.Arguments.GetParameterValueAsIs($oofStartDateParameterName)
$automaticReplies.StartTime = $startTime

$endTime = $Context.Arguments.GetParameterValueAsIs($oofEndDateParameterName)
$automaticReplies.EndTime = $endTime

$endDate = $endTime.ToShortDateString()
$oofMessage = [System.String]::Format($oofMessageTemplate, @($endDate, $fullName, $phoneNumber, $email))

# Internal message
$automaticReplies.InternalMessage = $oofMessage

# External message
$automaticReplies.ExternalAudience = "ADM_EXCHANGE_EXTERNALAUDIENCETYPE_ALL"
$automaticReplies.ExternalMessage = $oofMessage
$mailboxParams.AutoReplyConfiguration = $automaticReplies

# Save changes
$targetUser = $Context.BindToObjectByDNEx("%distinguishedName%", $True)
$targetUser.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_RESOLVEVALUEREFERENCES")
0

Hello,

it works fine, but one little problem showed up. The CN of our users is in the format "lastname.firstname". In the OOF-message should be "givenName SN" Is it possible to change the script, so we get "givenName SN" ? Except from that, it is exactly what we want. Thanks

0

Hello,

The thing is that the Full Name (LDAP name cn) property is mandatory in AD and cannot be empty (and you have it formatted as lastname.firstname). At the same time First Name (LDAP name givenName) and Last Name (LDAP name sn) can be empty. We can update the script to use the properties instead, but what should be done if either of them or both are empty?

0

Hello,

both attributes (givenName, SN) are mandatory in our company. In every user both fields are filled.

0

Hello, Thank you for the confirmation. Here is the updated script.

$phoneNumberPropertyName = "telephoneNumber" # TODO: modify me
$userParameterName = "param-Vertretung" # TODO: modify me
$oofStartDateParameterName = "param-abw-beginn" # TODO: modify me
$oofEndDateParameterName = "param-abw-ende" # TODO: modify me
$oofMessageTemplate = "I am on vacation until {0} 
and will not see your message until then. 
Your message sits safely in my Inbox awaiting my return.
If you need immediate assistance, please contact {1} {2} at {3} {4}." # TODO: modify me

# Bind to the source user
$userDN = $Context.GetParameterValue($userParameterName)
$user = $Context.BindToObjectByDN($userDN)

# Get source user first and last name
$firstName = $user.Get("givenName")
$lastName = $user.Get("sn")

# Get source user phone number
try
{
    $phoneNumber = $user.Get($phoneNumberPropertyName)
}
catch
{
    $phoneNumber = $NULL
}

# Get source user email
try
{
    $email = $user.Get("mail")
}
catch
{
    $email = $NULL
}

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Schedule OOF
$automaticReplies = $mailboxParams.AutoReplyConfiguration
$automaticReplies.AutoReplyState = "ADM_EXCHANGE_OOFSTATETYPE_SCHEDULED"

$startTime = $Context.Arguments.GetParameterValueAsIs($oofStartDateParameterName)
$automaticReplies.StartTime = $startTime

$endTime = $Context.Arguments.GetParameterValueAsIs($oofEndDateParameterName)
$automaticReplies.EndTime = $endTime

$endDate = $endTime.ToShortDateString()
$oofMessage = [System.String]::Format($oofMessageTemplate, @($endDate, $firstName, $lastName, $phoneNumber, $email))

# Internal message
$automaticReplies.InternalMessage = $oofMessage

# External message
$automaticReplies.ExternalAudience = "ADM_EXCHANGE_EXTERNALAUDIENCETYPE_ALL"
$automaticReplies.ExternalMessage = $oofMessage
$mailboxParams.AutoReplyConfiguration = $automaticReplies

# Save changes
$targetUser = $Context.BindToObjectByDNEx("%distinguishedName%", $True)
$targetUser.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_RESOLVEVALUEREFERENCES")
0

Hello,

now its working as we wish.

One extra question: Is it possible to mark the users, which have an active Out-of-Office-Message. Like this: image.png

Of course with a different icon, maybe a custom one?

0

Hello,

Unfortunately, there is no such possibility.

Related questions

0 votes
0 answers

Hallo Everyone I've seen the Report for Exchange Mailboxes with OU, Send on Behalf, Full Rights and Send As Rights: https://www.adaxes.com/questions/ ... . Example: User: Peter.Steinmann Identity: Which Mailboxes AccessRights: FullAccess Kind regards,

asked 3 hours ago by Sandberg94 (290 points)
0 votes
1 answer

Is there a way to get the name of the user who approved a request and supply that to a step inside of a custom command? For example, HR submits a status change for an employee. ... and pass it as a param in a custom command that is called in one of the steps?

asked May 12, 2021 by davfount90 (20 points)
0 votes
1 answer

Good morning, I need to get the serial number of PC and update the description with the value result. I tried with %serialNumber% but the is empty. Can u help me? thanks, Simone

asked Nov 17, 2021 by Simone.Vailati (270 points)
0 votes
1 answer

We would like to auto enroll our entire company into Adaxes for self service but do not want to use the question/answer format but instead their phone numbers (provided by HR department). Is this possible? Best, Evangelos

asked Oct 1, 2021 by evangelos (60 points)
0 votes
1 answer

Let's say I have a Business Rule that is fired prior to adding members to a group. Is it possible to get the number of objects being added to that group as ... that tells me that 6 objects will be added or is each added user treated completely independently?

asked Apr 20 by ngb (90 points)
2,762 questions
2,495 answers
6,540 comments
1,485,744 users