-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoke-MgGraphRequest can't handle URI with # #1947
Comments
Hi @julmsy , have you tried to URL encode the # sign? The Graph explorer tool will automatically URL encode that. |
Yeah, good call Ray. Replace # with %23
Just out of curiosity though, is there a reason you can't use Get-MgUser? This works out of the box and will retrieve the same sort of info
It's no big deal if you have a good reason to use Invoke-MgGraphRequest, I'm just wondering if you had a reason. |
Perhaps an idea to use [System.Web.HttpUtility]::UrlEncode(“the raw URL you want to pass to Invoke-MgGraphRequest”) instead of the raw URL itself - that way any characters with special meaning will be translated
Fra: SeniorConsulting ***@***.***>
Sendt: 17. april 2023 23:13
Til: microsoftgraph/msgraph-sdk-powershell ***@***.***>
Cc: Subscribed ***@***.***>
Emne: Re: [microsoftgraph/msgraph-sdk-powershell] Invoke-MgGraphRequest can't handle URI with # (Issue #1947)
Yeah, good call Ray.
Replace # with %23
$uri = ***@***.***'
Invoke-MgGraphRequest -Method GET -Uri $uri
—
Reply to this email directly, view it on GitHub<#1947 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOROZPASADIADMGIEY3JBGTXBWW35ANCNFSM6AAAAAAXAZNLHY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.******@***.***>>
|
Hello everyone, Thanks for the suggestion @RayGHeld, it works like a charm. I hadn't thought of encoding in HTTP format.
@SeniorConsulting, well I can use Get-MgUSer right, but using Invoke-MgGraphRequest is better to handle exceptions. I'm able to get the HTTP code, and depending of the answer (404, throttling, etc.) I can play different scenarios. Here is part of my code:
|
Reopening the issue due to a bug introduced in #2488. |
Hello,
I would like to use the Invoke-MgGraphRequest cmdlet to request Guest users. Guest users' UPN contains '#' characters.
Example: first.last_foo.com#EXT#@contoso.onmicrosoft.com
If I request the same URI on MS Graph Explorer, it works well.
It seems that Invoke-MgGraphRequest cut the URI at the first '#' character.
I've tried different variations, but issue persists:
Could you please have a check and fix it?
Module version tested: 1.20.0 and 1.25.0.
Best,
julmsy
The text was updated successfully, but these errors were encountered: