cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User III
Super User III

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
Super User III
Super User III

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).

Super User III
Super User III

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

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (74,089)