Hello Boris,
First of all, all value references in all Adaxes scripts must be wrapped into double quotes. Otherwise, the script can be incorrectly recognized by PowerShell after resolving value references. Also, your parameter is of Directory object picker type. It means that the value reference for the parameter will resolve into a distinguished name (DN) which is unacceptable for the -ForwardingTarget parameter of the Set-CsUserCallingSettings cmdlet. To achieve the desired, you need to have something like below in your script. In the code sample, the $propertyName variable specifies the schema name of a property. The property value will be taken from the account specified in the custom command parameter and passed to the cmdlet parameter.
$propertyName = "mobile" # TODO: modify me
# Get property value
$parameterObject = $Context.BindToObjectByDN("%param-deputycall%")
try
{
$value = $parameterObject.Get($propertyName)
}
catch
{
$Context.LogMessage("Property $propertyName is not specified for the forwarding target.", "Warning")
return
}
Set-CsUserCallingSettings -Identity "%userPrincipalName%" -IsForwardingEnabled $true -ForwardingType immediate -ForwardingTargetType singletarget -ForwardingTarget $value