locked
Populate account information RRS feed

  • Question

  • I would like to create a form that has fields for First Name, Last Name, Phone & email.  I would also like to have a "people picker" field. When someone enters their name in the people picker and their account is found, i would like the other 4 fields to be immediately populated (with the first/last name, phone & email).  Is this possible? 
    Monday, February 12, 2018 8:21 PM

Answers

  • Hi kiddna,

    As Cameron mentioned, we can use InfoPath form to achieve that. To get user information by people picker column, we need to use GetUserProfileByName method in InfoPath.

    Here are the steps for your reference:

    1. Open InfoPath and click the DATA tab, then click From SOAP Web Service under From Web Service.

    2. Enter the location of the SOAP Web service definition: http://<site>/_vti_bin/userprofileservice.asmx, then click Next.

    3. Select GetUserProfileByName and click Next.

    4. Make sure ‘Automatically retrieve data when form is opened’ is checked.

    5. Add a people picker control and other control as you want to use in the form.

    6. Insert a button for querying and loading user information.

    (1) Highlight the button, and then create an Action rule.

    (2) Set AccountName with the AccoundId from the people picker column for querying user information.



    (3) Query the data connection with the new AccountName.

    (4) Set other fields.

    Leave the middle drop down as is (‘is equal to’) and in the last drop down choose ‘type a text…’. Type “FirestName” or ” LastName” which you want to show in the field.



    For more information, check the following blog:

    https://www.c5insight.com/Resources/Blog/tabid/88/entryid/309/Auto-Populate-a-SharePoint-2010-Contact-List-from-User-Profile-Data.aspx

    Another method, you can use JSOM as Asfaw Ayele suggested.

    Best regards,

    Linda Zhang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Proposed as answer by Dean_Wang Monday, February 19, 2018 6:56 AM
    • Marked as answer by kiddna Tuesday, February 20, 2018 9:07 PM
    Tuesday, February 13, 2018 8:39 AM

All replies

  • Hi kiddna- I'm assuming you're using InfoPath? If so, then yes, you can do that with a data connection.

    If you're not using a form solution, I can't think of any way to accomplish what you want OOTB.


    cameron rautmann

    Monday, February 12, 2018 9:11 PM
  • CSOM is also an option and here is for your reference:

    https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-retrieve-user-profile-properties-by-using-the-javascript-object-model-in 

    Monday, February 12, 2018 9:23 PM
  • Hi kiddna,

    As Cameron mentioned, we can use InfoPath form to achieve that. To get user information by people picker column, we need to use GetUserProfileByName method in InfoPath.

    Here are the steps for your reference:

    1. Open InfoPath and click the DATA tab, then click From SOAP Web Service under From Web Service.

    2. Enter the location of the SOAP Web service definition: http://<site>/_vti_bin/userprofileservice.asmx, then click Next.

    3. Select GetUserProfileByName and click Next.

    4. Make sure ‘Automatically retrieve data when form is opened’ is checked.

    5. Add a people picker control and other control as you want to use in the form.

    6. Insert a button for querying and loading user information.

    (1) Highlight the button, and then create an Action rule.

    (2) Set AccountName with the AccoundId from the people picker column for querying user information.



    (3) Query the data connection with the new AccountName.

    (4) Set other fields.

    Leave the middle drop down as is (‘is equal to’) and in the last drop down choose ‘type a text…’. Type “FirestName” or ” LastName” which you want to show in the field.



    For more information, check the following blog:

    https://www.c5insight.com/Resources/Blog/tabid/88/entryid/309/Auto-Populate-a-SharePoint-2010-Contact-List-from-User-Profile-Data.aspx

    Another method, you can use JSOM as Asfaw Ayele suggested.

    Best regards,

    Linda Zhang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Proposed as answer by Dean_Wang Monday, February 19, 2018 6:56 AM
    • Marked as answer by kiddna Tuesday, February 20, 2018 9:07 PM
    Tuesday, February 13, 2018 8:39 AM