Help sought in using the UserProfileService web service from an InfoPath browser based form - InfoPath Dev
in

InfoPath Dev

Help sought in using the UserProfileService web service from an InfoPath browser based form

Last post 06-22-2009 09:32 AM by mjm917. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-22-2009 06:58 AM

    Help sought in using the UserProfileService web service from an InfoPath browser based form

    I've been testing a technique I found on several web sites of accessing the UserProfileService web service, with the GetUserProfileByName method, to obtain information about the current user without having to write any C#, etc. code.

    I can get information about myself into an InfoPath text field okay.

    I have a slightly different scenario with which I need help.

    When the form is created new, I want to populate fields with the current user's account name, Preferred Name, Department, and email address. This I can do, placing the results into text fields.

    What I want the form to be able to do, however, is to allow the user to replace his/her own current account name in one of the text boxes with the name of someone
    else's account, take some action (button press, etc.), and have InfoPath retrieve that person's profile and place their information
    into the fields.

    Of course, once the form is saved, subsequent opening by someone should NOT replace the form data with that user's information.

    Is this doable? How do I pass along an account name as an argument to the GetUserProfileByName methods?

    Thank you for your help

    http://wiki.tcl.tk/
  • 05-26-2009 11:58 PM In reply to

    Re: Help sought in using the UserProfileService web service from an InfoPath browser based form

    Hi LVirden and welcome,

    Not sure how to do that. I want to say it can't be done based on some very old info in my head, but I'm not sure. One thing that is sure is that our ultra cheap Active Directory Web Service does support this scenario and we have numerous blogs written on how to do it. You can even get manager information and the tool comes with one hour of free InfoPath MVP support. Holy Sheepdip Sherlock...

    Patrick Halstead
    Project Manager at Qdabra
  • 06-12-2009 12:45 PM In reply to

    Re: Help sought in using the UserProfileService web service from an InfoPath browser based form

    Yes, you can do this, and I think it's pretty simple.

    what you first have to realize is that when you create a data connection using this web service, you set it to default to the logged-in user and query automatically upon opening.  what you're doing is sending the current user's username (same value as userName()) as the query parameter for the GetProfileByName web method.  It then returns a large data set of attributes for that user as defined in the Profile Database of your SSP.  In order to retrieve the same data for another user, you simply have to set up another query to the same web method using a different username.  A simple way to accomplish this:

    1) Create a custom button on your canvas set to "Rules and Custom Code."

    2) Create a Rule for "Set field's value to" on the QUERY node of the GetProfileByName data connection that populates from the username field you're using.  This basically sends the username of your choice (whatever is currently in that field) to the query parameter field of the web service.

    3) Create a Rule for "Query data connection" and choose the GetProfileByName DC.  This will query the web service using the new username you gave it above

    4) Either using rules or default values, have it populate your other fields automatically with the new data set.

    Using a button lets you define WHEN the data gets populated instead of it auto-populating upon opening the form.  The only thing you have to figure out is how to get people's usernames for use in that username box.  One possibility is to have a custom contacts list that has people's full names in one column and username in another column.  Then, you can create a data connection to it, change your username control to a dropdown, set the dropdown to that new DC, set the display name to the full name column, and set the Value to the username column.  Then, people have a user-friendly way of choosing a colleague's real name followed by pushing a button to get that colleague's attributes.  Depending on your requirements, you can do several things here.

  • 06-18-2009 01:06 PM In reply to

    • mjm917
    • Not Ranked
    • Joined on 08-22-2008
    • Naperville, IL
    • Posts 16

    Re: Help sought in using the UserProfileService web service from an InfoPath browser based form

    I am trying to do the same thing. For whatever reason I am confused by your postso I was wondering if you could post a sample form that I could look at. Thanks in advance.

    Thx

    mjm917
  • 06-18-2009 08:02 PM In reply to

    Re: Help sought in using the UserProfileService web service from an InfoPath browser based form

    mjm917:
    I am trying to do the same thing. For whatever reason I am confused by your postso I was wondering if you could post a sample form that I could look at. Thanks in advance.

    I am going to do a full blog entry showing the steps in detail, but that won't happen overnight (probably over the weekend).  In the meantime, if you tell me which part you can't follow, then I can try to walk you through it.

  • 06-20-2009 11:32 PM In reply to

    Re: Help sought in using the UserProfileService web service from an InfoPath browser based form

  • 06-22-2009 09:32 AM In reply to

    • mjm917
    • Not Ranked
    • Joined on 08-22-2008
    • Naperville, IL
    • Posts 16

    Re: Help sought in using the UserProfileService web service from an InfoPath browser based form

    You are AWESOME! Thanks for putting this together. My problem was trying to set/change the AccountName parameter of the UserProfileService web service.

    Thx

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