简体   繁体   中英

Microsoft Graph filter on a displayName with + in it

We have automation code that has been running for quire some time now.

The code retrieves a specified Azure AD Group by displayName. In some cases, the displayName contains a + sign. Until recently, that was not an issue, but now the query returns nothing, it we query the displayName with a + in it.

The uri looks like this:

https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayName,'My Group with a + in it')

If we only query the part up to the + sign, the group is returned as expected.

https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayName,'My Group with a')

This has been working, but we would be more then happy with a solution that enables us to just escape the + sign and get the payload. We have tried url-encoding the uri without any luck.

I can reproduce your issue, to fix it, just url-encode the + sign with %2B , refer to the sample below.

In my sample, my group named joytest+group , I filter it with joytest+g , encode the + sign, then it will be joytest%2Bg .

GET https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayName,'joytest%2Bg')

Test in the Graph Explorer , it works fine.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM