cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cattre
Resolver I
Resolver I

Unable to get user (Send an HTTP request to SharePoint) when email contains apostrophe

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! 

2 ACCEPTED SOLUTIONS

Accepted Solutions

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

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

@abm perfect, thanks! For reference, I used the replace function as below:

replace(body('Get_user_profile_(V2)')?['mail'],'''','%27%27')

 

View solution in original post

4 REPLIES 4
abm
Super User
Super User

Hi @cattre 

 

Try using expression encodeUriComponent to convert the email single quotes to %27

 

Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

@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

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

@abm perfect, thanks! For reference, I used the replace function as below:

replace(body('Get_user_profile_(V2)')?['mail'],'''','%27%27')

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (3,084)