Created
September 8, 2021 13:36
-
-
Save baywet/33b6af6b40fe175324b27b534392ba52 to your computer and use it in GitHub Desktop.
AGS request payload compression test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$accessToken = "<AccessTokenWithMailSendPermission>" | |
$srcFileName = "PathToRequestPayloadUncompress-SeeOtherFile" | |
$destFileName = "APath" | |
$srcFileStream = New-Object System.IO.FileStream($srcFileName,([IO.FileMode]::Open),([IO.FileAccess]::Read),([IO.FileShare]::Read)) | |
$destFileStream = New-Object System.IO.FileStream($destFileName,([IO.FileMode]::Create),([IO.FileAccess]::Write),([IO.FileShare]::None)) | |
$gzip = New-Object System.IO.Compression.GZipStream($destFileStream,[System.IO.Compression.CompressionMode]::Compress) | |
$gzip.CopyTo($srcFileStream) | |
$gzip.Flush() | |
$destFileStream.Dispose() | |
Invoke-WebRequest -UseBasicParsing -Uri "https://graph.microsoft.com/v1.0/me/sendMail" ` | |
-Method "POST" ` | |
-Headers @{ | |
"Authorization"="Bearer $accessToken" | |
"Accept"="*/*" | |
"Accept-Encoding"="gzip, deflate, br" | |
"Content-Encoding"="gzip" | |
} ` | |
-ContentType "application/json" ` | |
-InFile $destFileName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"message":{"subject":"Meet for lunch?","body":{"contentType":"Text","content":"The new cafeteria is open."},"toRecipients":[{"emailAddress":{"address":"[email protected]"}}]}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment