Hi,
I've recently noticed flows failing due to the HTTP request action not being able to retrieve the user ID from SharePoint for users with an apostrophe in their email (it works with all other users). The error message just implies it's not a valid request:
The expression "web/SiteUsers/getByEmail('firstname.O'lastname@domain.com')" is not valid.
Is there a workaround (e.g. escape character) to pass in email addresses with apostrophes? If not, is this a known issue that's likely to be resolved any time soon? Any other suggestions for how I can retrieve user IDs from SharePoint?
Thanks!
Solved! Go to Solution.
Hi @cattre
I was expecting that should work. Ok please try hardcoding the email as a test with two %27. Please see below.
_api/web/SiteUsers/getByEmail('firstname.O%27%27lastname%40domain.com')
If that works then try replace expression to convert single quote to two %27.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blog@abm perfect, thanks! For reference, I used the replace function as below:
replace(body('Get_user_profile_(V2)')?['mail'],'''','%27%27')
Hi @cattre
Try using expression encodeUriComponent to convert the email single quotes to %27
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blog@abm thanks for the suggestion. Tried with both encodeUriComponent and UriComponent (the latter is apparently "preferred" by MS for some reason). The input to the request looks good:
_api/web/SiteUsers/getByEmail('firstname.O%27lastname%40domain.com')
Unfortunately it still throws the same error. The output shows the email address with unencoded characters (i.e. same error message as before).
Hi @cattre
I was expecting that should work. Ok please try hardcoding the email as a test with two %27. Please see below.
_api/web/SiteUsers/getByEmail('firstname.O%27%27lastname%40domain.com')
If that works then try replace expression to convert single quote to two %27.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blog@abm perfect, thanks! For reference, I used the replace function as below:
replace(body('Get_user_profile_(V2)')?['mail'],'''','%27%27')
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.