Comments (4)
When I add the attachment, it returns a 404 bad request, when I remove the attachment part it works fine.
$Request=@"
{
"Message": {
"Subject": $(Escape-StringToJson $Subject),
"Body": {
"ContentType": "HTML",
"Content": $(Escape-StringToJson $Message)
},
"ToRecipients": [
{
"EmailAddress": {
"Address": "$Recipient"
}
}
],
"attachments": [
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "attachment.txt",
"contentType": "text/plain",
"contentBytes": "SGVsbG8gV29ybGQh"
}
]
},
"SaveToSentItems": "$(if($SaveToSentItems){"true"}else{"false"})"
}
"@
from aadinternals.
Also, any idea why this doesn't work with a access token and does work with a app registration in Graph Explorer Developer?
$url="https://graph.microsoft.com/beta/me/mailFolders/inbox/messageRules"
Invoke-RestMethod -UseBasicParsing -Uri $Url -Method GET -Headers @{Authorization = "Bearer $($attributes.EXO)"} -Debug
VERBOSE: GET https://graph.microsoft.com/beta/me/mailFolders/inbox/messageRules with 0-byte payload
Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At line:5 char:9
+ Invoke-RestMethod -UseBasicParsing -Uri $Url -Method GET -Hea ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
from aadinternals.
Or this, any help would be appreciated :)
`$headers = @{
"Authorization" = "Bearer $($attributes.EXO)"
"Accept" = "gzip, deflate, br"
"Accept-Encoding" = "gzip, deflate, br"
"Accept-Language" = "en-US,en;q=0.9"
}
$url="https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messagerules"
Invoke-RestMethod -UseBasicParsing -Uri $Url -Method GET -Headers $headers
`
from aadinternals.
https://graph.microsoft.com requires that the client you are using has permissions to the API you're calling. You can check the scp claim from the access token to see the permissions with Read-AADIntAccessToken
or at https://aka.ms/JWT
What comes to sending attachments, I haven't tried that in years so can't tell what's wrong in your code. Try to double-check the attribute names and structure (should the first letter be capital etc.).
from aadinternals.
Related Issues (20)
- New-AADIntBulkPRTToken Request Failing HOT 4
- "ObjectId" in device certificate should be renamed to "AuthUserObjectId" HOT 4
- Error when attempting to import module in powershell core HOT 1
- Azure Government / national cloud support HOT 4
- Federated identities are not supported HOT 3
- Rename Repo from AADInternals to MSEntraIDInternals 🤣 HOT 2
- Possible authentication issue with “TROOPERS23 edition”. HOT 1
- Dependencies - List HOT 1
- Install getting blocked by AV HOT 1
- Get MFA token HOT 1
- Allow suppression of import-module message HOT 2
- Add Support for SQL(Express) for Get-AADIntSyncCredentials HOT 1
- Authentication issue after updating to 0.9.1 HOT 3
- Support AAD device token flows
- aadsync_client_build = 1.5.29.0 broken
- Cannot login to tenant with Get-AADIntAccessTokenForAADGraph HOT 1
- Does AADInternals works in macOS?
- Incompatible parameter sets in Open-AADIntOffice365Portal
- KeySignTest : FAILED (transport key) HOT 1
- AccessToken_utils.ps1 - ConvergedProofUpRedirect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aadinternals.