Share via

Using PowerShell getting bad request

Michael Thorne 0 Reputation points
2023-04-12T11:56:21.9833333+00:00

Trying to filter mail in PowerShell Script with Graph API. Getting bad request can someone help

@{'Authorization' = "Bearer $token"; "Content-Type" = "application/json" }  
      
$method = "GET"  
$uri = "https://graph.microsoft.com/v1.0/users/{user-id}}messages?$filter=from/emailAddress/address eq '******@gmail.com'"  
Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. Shivam Dhiman 6,086 Reputation points
    2023-04-12T12:09:57.79+00:00

    Hi @Michael Thorne

    When you are using $filter in PowerShell it will take it as Variable, so you need to use it like `$filter in above API. Please refer to this similar case for more details. Hope this helps.
    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.