functions/mailItems/Get-EXREmailHeaders.ps1
function Get-EXREmailHeaders { [CmdletBinding()] param ( [Parameter(Position = 0, Mandatory = $true)] [string] $MailboxName, [Parameter(Position = 1, Mandatory = $false)] [psobject] $AccessToken, [Parameter(Position = 2, Mandatory = $false)] [psobject] $ItemRESTURI ) Begin { if($AccessToken -eq $null) { $AccessToken = Get-ProfiledToken -MailboxName $MailboxName if($AccessToken -eq $null){ $AccessToken = Get-EXRAccessToken -MailboxName $MailboxName } } if([String]::IsNullOrEmpty($MailboxName)){ $MailboxName = $AccessToken.mailbox } $HttpClient = Get-HTTPClient -MailboxName $MailboxName $RequestURL = $ItemRESTURI + "/internetMessageHeaders" $JSONOutput = Invoke-RestGet -RequestURL $RequestURL -HttpClient $HttpClient -AccessToken $AccessToken -MailboxName $MailboxName return $JSONOutput } } |