PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, June 28, 2022

[FIXED] How to pass # character for the $filter to Microsoft Graph?

 June 28, 2022     active-directory, azure-active-directory, graph, microsoft-graph-api, postman     No comments   

Issue

I try to filter the following user using Microsoft Graph by userPrincipalName:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
    "value": [
        {
            "businessPhones": [],
            "displayName": "Champi Non Buen Dia",
            "givenName": "buendiachampi",
            "jobTitle": null,
            "mail": "champinon.buendia@champi.com",
            "mobilePhone": null,
            "officeLocation": null,
            "preferredLanguage": null,
            "surname": "urrutia",
            "userPrincipalName": "champinon.buendia_champi.com#EXT#@avtestonline.onmicrosoft.com",
            "id": "c6d071ee-5d89-49bb-ac23-768720e5eff4"
        }
    ]
}

When I request with the following URL I get the above JSON result:

https://graph.microsoft.com/v1.0/users?$filter=startswith(userPrincipalName,'champinon.buendia_champi.com')

, but if I add to the filter #EXT# I get a bad request result, how can I pass that character in the filter value?

https://graph.microsoft.com/v1.0/users?$filter=startswith(userPrincipalName,'champinon.buendia_champi.com#EXT#')

The reason why I need to do as is, is that the user must be forced to enter the full username and not a part of it, that #EXT# makes the filtering more accurate, because the username entered in must match with the #EXT#.


Solution

The value of #EXT# must be passed encoded as %23EXT%23:

https://graph.microsoft.com/v1.0/users?$filter=startswith(userPrincipalName,'edgardo.urrutia_tcs.com%23EXT%23@')


Answered By - Sabila2022
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing