Public/Get-ADPSecondEmail.ps1
function Get-ADPSecondEmail { <# .SYNOPSIS Get a user's Second Email from ADP .DESCRIPTION Get a user's Second Email from ADP .PARAMETER ADPObject Object which holds the Second Email .EXAMPLE Input Object: ADP Object Return String: <Second Email> .NOTES This is used when passing the full adp worker object from ADP's APID .FUNCTIONALITY Powershell Language #> [CmdletBinding()] param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] $ADPObject ) $secondEmail = $null try { $secondEmail = $ADPObject.person.communication.emails.emailUri.ToLower() } catch {} return ( $secondEmail | Get-ValidADPReturn ) } |