#------------------------------- Read Mail------------------------------------------------- Import-Module Microsoft.Graph.Users # Define your Client ID, Tenant ID, and Client Secret $clientId = "587xxxxxxxxxxxxxxxxxxxx748ad" $tenantId = "8d15xxxxxxxxxxxxxxxxxxxxxxxxx20c04470" $clientSecret = "hZqxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbaT" # Convert the client secret to a secure string $secureClientSecret = ConvertTo-SecureString -String $clientSecret -AsPlainText -Force # Create a PSCredential object $credential = New-Object System.Management.Automation.PSCredential ($clientId, $secureClientSecret) # Connect to Microsoft Graph using the PSCredential object Connect-MgGraph -TenantId $tenantId -ClientSecretCredential $credential # Get Another Users Emails Only Able to be Completed using this type of TenantID Auth Get-MgUserMessage -UserId "dawn@scriptsbyscott.com" -Top 10 | select *