test/tracing.ps1

# beispiele

$mtid = '802c1e57-73d6-4e06-de1a-08dabe6f8ce3'
$mId = '<FRYP281MB2462B7FA1A1D826E9DD4569A933B9@FRYP281MB2462.DEUP281.PROD.OUTLOOK.COM>'
$s2 = 'exoadmin@smct2.com'

function Get-sc365Messagetrace {
    param (
        $messageId
    )

    $MessageTrace = Get-Messagetrace -MessageId $messageid |Where-Object Index -eq 0
    $MessageTraceId = $MessageTrace.MessagetraceId.Guid
    $RecipientAddress = $MessageTrace.RecipientAddress
    
    $messageTraceFirst = Get-MessagetraceDetail -Messagetraceid $MessagetraceId -RecipientAddress $recipientAddress|select-object -first 1
    
    $Data = $messageTraceFirst.Data
    $customData = $Data -split '<' -replace '>',''|select-string '"CustomData"'
    $IBCString = $customData -split ';'|select-string 'S:InboundConnectorData=Name=' -NoEmphasis
    $ibcName = $ibcstring -split "'S:InboundConnectorData=Name="

    $messageTraceFirst.Detail
    $messageTraceFirst.Event
    $messageTraceFirst.Date
    $ibcName 
}

Get-sc365Messagetrace $mid

# SIG # Begin signature block
# MIIL/AYJKoZIhvcNAQcCoIIL7TCCC+kCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDhQT7trM2riEqD
# 2+cwLTSOA+lFcajVZo8Eho7/tEiNTaCCCUAwggSZMIIDgaADAgECAhBxoLc2ld2x
# r8I7K5oY7lTLMA0GCSqGSIb3DQEBCwUAMIGpMQswCQYDVQQGEwJVUzEVMBMGA1UE
# ChMMdGhhd3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2Vz
# IERpdmlzaW9uMTgwNgYDVQQLEy8oYykgMjAwNiB0aGF3dGUsIEluYy4gLSBGb3Ig
# YXV0aG9yaXplZCB1c2Ugb25seTEfMB0GA1UEAx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