Skip to main content

Alana Helbig

Go Search
Home
Speaking Events
White Papers
 Help (new window) 
 

Alana Helbig > Posts > Use the Contact Selector in InfoPath to get user details – no code required

Comments

Clayton Cobb

I guess you're talking about me, hah.  I also use the Contact Selector a lot and do this very thing using the same concepts in my blog post that you referenced.

The only thing I wanted to clarify is the AccountId.  Is it just in the form of username or is it domain name (domain\username)?  I can't check my system right now, but I thought I remembered it being domain name and having to use substring-after to strip out the username before sending it to the web service.

Anyway, great job.  Another nugget is that you can use GetCommonManager and send your username straight to it in order to return the Manager's personal info without the double-hit to GetUserProfileByName.  I didn't put that in my blog, but I thought you'd like to know about it.  GetCommonManager accepts a username and returns that user's manager's profile info.  Pretty cool...
at 18/07/2009 5:25 PM

Re: Use the Contact Selector in InfoPath to get user details – no code required

Hi Clayton. Thanks for the 'GetCommonManager' tip. I'll have to give that one a go.
Yes, it's funny you mention the AccountId. I actually did originally strip out the domain name as you suggest. As I was writing this post, I thought I'd just test to see if it worked directly off the AccountId and it did. I must admit though that I only tested this in the browser so client behaviour might be a little different.....
Thanks again.
at 18/07/2009 11:08 PM

AccountId

That would very strange but very interesting if all of these web methods could accept username AND domain name.  I had always used username, because I knew that's what InfoPath sent by default upon Form Load.  If it can accept the full domain name, then that just opens up more options and saves me a step each time I need to use the domain name.  Very cool.
at 19/07/2009 12:22 AM

AccountId

Clayton, just tested this in the client and in the browser. The username and domain name work in the browser. However, in the client it doesn't work. Seems that removing the domain name using the sub-string function as you mention is required if the form is going to be used on the client side.....
at 19/07/2009 12:58 PM

re: AccountId

Hmm, well I was working on some stuff related to my new blog entry from last night regarding User Roles in Browser Forms leveraging AD groups, and during the testing I had a Contact Selector that would allow users to choose a new user in order to see that user's memberships.  I simply let it pass the full domain name (AccountId) from the contact selector to both of my web methods (both part of the UserProfileService), and they worked.  Yes, I was building a browser form, but it always worked in preview mode, which would indicate that it works in the rich client.  In your testing, does it not work in the rich client?
at 21/07/2009 9:36 AM

Blogroll

Alana, I also added you to my Blogroll, so that's a way of saying, "Great Job!" on what you've doing here.  I'm very passionate about the same things you are and love to see that light bulb go off, so we are of the same ilk.  Good on ya.
at 21/07/2009 9:37 AM

Blogroll and Account Id

Hey Clayton. Thanks :-).
It didn't work for me in the client when I tested it... but I may have just been having a blonde moment.... I'll test it again and let you know how I go.
at 21/07/2009 10:14 AM

Re: Use the Contact Selector in InfoPath to get user details – no code required

Thanks for this help ,
I have done everything ->enter the name into the Contact Selector but   the  fields dont want to be auto populated.

Mariya
at 6/08/2009 3:07 AM

doesn't work

i tried it several times, but i couldn't get to a result for departement and the others!!!

Does anyone else have this problem ?
at 17/08/2009 11:40 PM

Didn't work for me either

I followed the process step-by-step and it didn't autopopulate the form. :(
at 21/08/2009 3:36 AM

Not working?

Hi Mariya,
Firstly, did you try Itay Shakury's blog (link at the top of this post) and are you getting results just using this method? You should check that you can definately get 'Department' or 'Manager' using this method. If you are not, then you will need to talk to your SharePoint administrators and ask them to incorporate this into their Profile Imports.

My next suggestion would be to look at the rules on the AccountId field. It is important that they are in the exact order specified in this post. This is normally where people come unstuck.

Let me know how you go.

Alana
at 21/08/2009 7:07 AM

Looks like a great thing.....but does it work on Webenabled 2007 forms

I tried and i'm getting a data connection error after i select the mangers name and first example of department does not populate
at 22/08/2009 2:26 AM

Looks like a great thing.....but does it work on Webenabled 2007 forms

I tried and i'm getting a data connection error after i select the mangers name and first example of department does not populate
at 22/08/2009 4:58 AM

Re: Use the Contact Selector in InfoPath to get user details – no code required

Firstly, did you try Itay Shakury's blog (link at the top of this post) and are you getting results just for the current user?  You should check that you can definately get 'Department' or 'Manager' for the current user. Then if you are, you can continue with this post. If you are not, then you will need to talk to your SharePoint administrators and ask them to incorporate this into their Profile Imports.

My next suggestion would be to look at the rules on the AccountId field. It is important that they are in the exact order specified in this post. This is normally where people come unstuck.

What data connection error are you getting?
at 22/08/2009 8:50 AM

Does it work in web enabled forms?

Yes it does work in browser enabled InfoPath 2007 forms.
at 22/08/2009 8:56 AM