Get email address from people picker - InfoPath Dev
in

InfoPath Dev

Get email address from people picker

Last post 05-08-2012 08:27 AM by traveladic. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 03-07-2012 09:37 PM

    Get email address from people picker

    I've googled this and seen 2007 offerings that either spoke of 3rd party options or long winded ways of doing this (usually using the CurrrentUser as the example)

    I hoped there might be something easier with 2010.
    I have a form that includes a people picker which points to our main SP site and works fine.

    I'd like an action on my form that gets the email address of the person in the people picker and sends the form to them as an attachment.

    Also, is there a way to add an action to a people picker? I only seem to be able to find a formatting option under rules.

  • 03-08-2012 05:50 AM In reply to

    Re: Get email address from people picker

    People Picker is pretty limited. It's no wonder that people turn to third party tools or complex methods; you have to work around the restrictions in People Picker. I wrote a blog post a few weeks ago. I think the easiest alternative might be to use SharePoint’s UserProfileService to obtain the user’s info.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-08-2012 11:47 AM In reply to

    Re: Get email address from people picker

    Thanks UserProfileService is the example I had seen but all the examples I saw assumed the email required was for the current user.

    Assuming domain/johnd

    We enter our user name in the people picker as johnd and this resolves to John Doe.
    I'd need to take that value and return [email protected] and put it "somewhere" so I could use it for an email action later.

    I've seen examples that take the first name of the current user and match this to FirstName and return email 

  • 03-09-2012 08:08 AM In reply to

    Re: Get email address from people picker

    But in that scenario, wouldn't FirstName need to be unique for the method to return only one email address?

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-09-2012 02:59 PM In reply to

    • JodyG
    • Not Ranked
    • Joined on 02-28-2012
    • Posts 14

    Re: Get email address from people picker

    Not sure if this will help because I am not using SP...just an Access DB...

    I gathered all short names (such as J. DOE) and corresponding emails of my dept and stored them in a db table and added as a secondary data source.

    Added a role and approval section that has fields such as "Requestor:" or "Final Approval:" in which the requestor fills names out.

    Created different email submits for each role.

    On the "To:" field in the email submit, I used the follwing rule expression:

    @Email_Adress[@ShortName = @Requestor] or @Email_Adress[@ShortName = @Engineer]...etc.

    This gives an email address from the table filtered by user input of short name = particular role.

    Fairly low tech and a bit of work to setup...but works good for the little stuff I am doing. Downside, I had to know upfront EXACTLY what everyone's email address is.

    Having that said, if you don't know the exact email address...you could probably use concat() or a simlar expression to build the address based on user input.

    Hope that helps :)

     

  • 03-11-2012 12:30 PM In reply to

    Re: Get email address from people picker

    Exactly, so that article is no good for me.
    I need to be able to send FirstName LastName (Is that what is called Displayname?) and return the email address for that person.

    The example uses FirstName and assumes the CurrentUser

  • 03-11-2012 12:32 PM In reply to

    Re: Get email address from people picker

    Thanks Jody, I'm hoping to get something that will be forever automated

  • 05-08-2012 08:27 AM In reply to

    Re: Get email address from people picker

    Don't know how your SharePoint site permission are managed but this works for me.

    In the people picker the AccountId field contains the username with the domain example infopathdev\traveladic.  I use substring-after(accountid, "\") which change it to travaladic which the email data connection can resolve. 

     The only problem I have had with this method is, I can only get it to work with one person selected in the people picker.  When I try this with multi people it only return the first name selected.  

Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.