How to get user email address in InfoPath form with SharePoint Online?

If you are still creating Business forms in InfoPath, with SharePoint online version – then at times you might want to get the email address of the user on form load.  In this blog, I will discuss how you can get email address of any of the domain user using the “substring after” InfoPath function.

1 – Edit the InfoPath form in your Form Library

2 – Create a text field and name it as “UserEmailID”

3 – Now, use this function to get the email address of the user. Edit text box properties -> see the Value area and click “fx” -> insert function Text-> substring -after and then write below lines:

substring-after(username(), “|membership|”)

The full account ID of the user is i:0#.f|membership|sumayyaaslam@abcxyz.com and this function returns only the email address of the user, which is after the |membership|

4 – Email address will be stored in the text field. The end.

If you have to get email address of any other user, then you can repeat the same process , pick their AccountID, use this function and store value in a text field.

Happy SharePointing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.