How can retrieve email address from the Infopath people/Group picker?When I add the people/Group picker into the infopath form, I only get 3 fields DisplayName,AccountId,AccountType.Can anyone show me how can I get the email either by configurations or by code.
Tell me more
×
SharePoint Stack Exchange is a question and answer site for
SharePoint enthusiasts. It's 100% free, no registration required.
|
You can query the UserProfileService using the accountid from your people picker. I wrote a simple class to do this from my form's code behind. Here's a quick sample with just the relevent bits (I'm typing from memory as I don't have the code in front of me, but you should be able to figure it out)... First, add a web reference to your machine's UserProfileService http://[your server]/_vti_bin/userprofileservice.asmx Then...
To call... UserInfo ui = new UserInfo( "domain\username" ); string email = ui.WorkEmail; Hope that helps! Cheers, Bob |
|||
|
|