Several of my customers have learned about the new feature of MOSS that includes publishing InfoPath forms to the server and thus allowing users that does not have InfoPath installed to fill in forms with no need for distributing nor purchasing InfoPath for each client.
One of the things they all have in common is that they all work in a Microsoft Active Directory environment and wish the form to load Meta data from the current user and to fill in the form with that data.
Now, InfoPath and AD does not have a method for creating a direct connection, but since all of our users also utilize the Microsoft Office SharePoint Server (MOSS) forms server – this means they can take advantage of other features and capabilities of MOSS for this problem.
MOSS connects to your AD easily and builds a user profile based on the data stored in AD for each user. This part is easy enough to perform so I will not elaborate further on that here.
Once your MOSS “knows” your users, you can make use of its web services to retrieve all users list, a specific user profile and also the current user profile.
Here I will demonstrate how to create a form that loads current user profile data as stored in AD without writing any bit of code.
The only thing that needs to be done is to define a connection to a certain web service that already exists in your SharePoint site out-of-the-box (OOTB).
Step 1: Create a blank form template
1. Click file->design a form template
Step 2: Setting up the web service connection
1. Create a new data source connection.
Go to tools –>Data connection

2. In the ”Data connections” dialog Click on Add

3. Select create a new connection to - Receive data Click next

4. Select Web service as the source type

5. Insert the Following web service name: http://<servername>/_vti_bin/userprofileservice.asmx?wsdl

6. Replace <servername> with your SharePoint server name and click next
2. In the ”Data connections” dialog Click on Add
3. Select create a new connection to - Receive data Click next
4. Select Web service as the source type
5. Insert the Following web service name: http://<servername>/_vti_bin/userprofileservice.asmx?wsdl
6. Replace <servername> with your SharePoint server name and click next
7. From the operations drop down list select GetUserProfileByName
8. In MOSS, calling this operation without sending a user name will return current user’s profile.
9. Click next keeping the defaults in every screen until you can hit Finish
10. Close the Data connection window.
Step 3: viewing and choosing the AD details we wish to import:
Now, we need to insert the AD information to the correct fields. To do so, we first need to see what kind of data we can use.
Since the users profile may include different properties according to software installed on your organization and other dependencies, the web service results returns a set of “name-value” collection that we can use in order to get re results we need.
So – first, we have to find the “name” of the property we need and use it to get its value from the web service.
Here is how it is done:
Since the users profile may include different properties according to software installed on your organization and other dependencies, the web service results returns a set of “name-value” collection that we can use in order to get re results we need.
So – first, we have to find the “name” of the property we need and use it to get its value from the web service.
Here is how it is done:
1. To see all the available fields click on View -> Data source

2. In the Data source drop-down select the one we just created.

2. In the Data source drop-down select the one we just created.
3. Expand the DataFields container node and select the following fields in the results:
4. In the drop-down menu on the selected nodes select repeating table and place it in the form.
5. This created a repeating table with all data returned by the web service. To see all the AD fields available to you, Click preview in the tool bar.

6. Now, locate the property you need and copy its name

7. Return to the design mode by clicking close preview.
6. Now, locate the property you need and copy its name
7. Return to the design mode by clicking close preview.
Step 4: placing the AD details in the controls:
Now the only thing left for us to do is place the field we chose earlier in step 3 and define the control to show that field’s info.
Now the only thing left for us to do is place the field we chose earlier in step 3 and define the control to show that field’s info.
to open the function editor
4. In the next window select to data source you created
5. Expand all the folders under dataFields until you can select the Value node.
6. This inserts one of the “values” we got in the web service response. Now we have to make it “filter” the values by the property name we want.
7. Click on filter Data button. In the pop up window click on add
8. In the next window select the following options
9. And select the “name” node from our service data source:
10. Click ok. Then Select type text and enter the property you copied in the previous section as the value
11.Click OK to confirm and close all the pop-ups.
Now your form displays the user preferred name as it was entered in the AD without writing 1 line of code!
Important:
Your document must be fully trusted in order to execute the web service correctly. To do so please check the tools-forms options form security options.
Important:
Your document must be fully trusted in order to execute the web service correctly. To do so please check the tools-forms options form security options.
This is a great demonstration how several Microsoft products can be combined to create excellent customer-specific solutions with just utilizing the capabilities of the OOTB features.
Thanks, Adi Lebovich,
KWizCom SharePoint KB
32 comments:
thx for this great tutorial. i don't need it at this time, but it's fine to know how to easily integrate a moss webservice.
Hi.
thanks for you post is very interesting.
I have a blog about infopath too.
be free to visit it
http://marcodiazjr.blogspot.com/
Hi!
Do you have any suggestions for how to populate a drop-down list with users from a given sharepoint group?
I know there is a webservice method that returns all the users in a group, but I can't make it work as a data source in InfoPath (ie. I can't bind a control to it since it's not repeating)
I'm trying to do this with a browser-enabled form btw.
i have a similar problem, i want o have a drop-down-list in an infopath-form where can pick out the name or - better - the mail-adress of users from the AD. Do you have any suggestion how to solve this?
Johannes Brüntrup
jbruentup@eds-midmarket.de
Hi!
I am bit worried about credentials each time web service is called? Is it the default credentials of logged in user or anonymous?
Majid
Hi,
Its very interesting to know aout fetching records from Active Directory.I followed your steps but i could not grasp initial step in step 4, that is
Step 4: placing the AD details in the controls:
Now the only thing left for us to do is place the field we chose earlier in step 3 and define the control to show that field’s info.
"Step 4: placing the AD details in the controls:
Now the only thing left for us to do is place the field we chose earlier in step 3 and define the control to show that field’s info."
How do i place the field and which field and how.Please reply me immediatly.
Thank you
Thanks to you a whole lot of opportunities popped up for me.
Like everyone else, I do have a follow on question...
What if I just want to retrieve the data once? In the Form the 'Requestor' can get auto-populate based on profilename...but then when someone else opens the form, bam, new 'requestor' inserted into the field.
hello
is userprofileservice.asmx a default file in sharepoint?
Thanks,
Joel
Sorry for asking this question... i know the answer :)
I have a different problem though... After following all the steps and previewing the IP form within my development box (windows server 2004/moss). I getting this message "infopath contacted a data source to recive data. the form will load without the reques data". Any thoughts of this problem. I have my IP form Security Trust to "Full".
Hi,
'Once your MOSS “knows” your users, you can make use of its web services to retrieve all users list, a specific user profile and also the current user profile.'
I would like to retrieve all users list to a droppdown list box entries. How can I handle that? Which is the right web service to call? And in which location?
BR,
Valtteri
Hi Joel,
userprofileservice.asmx is a part of MOSS out of the box web services.
This entire article requiers to have MOSS installed and not just WSS - if this is your case you are covered!
Works great, but when i try to open the Function Editor, it is greyed out. I'm assuming something to do with security on the AD Data Connection. However I can run and see the AD data. Any Ideas?
Hi, I have the same issue the fuction editor is greyed out ?
thaks
J
For non-developers this is a very easy and quick solution. Thanks
Is there a way to utilize this webservice with browser forms that dont support filtering?
DDingley
This is not AD. This is using Sharepoint web service.
Has anyone figured out the problem with the function button being grayed out? I would really appreciate getting some help with this!
How can i retrieve the user information by manually putting his name?
That is,I want that all the information about the user should come automatically once i write only his name in the name text box.
Awesome Post...Thnx a lot
I have the same problem with the function button being grayed out. Has anyone resolved this? Thanks
I worked out the gray function button problem. You need to add a text field to the form. This was overlooked in the otherwise very useful post (cant get it to work in browser though, hopefully resolvable later). Thanks for posting
It's really helpful! But I have a problem that some of the fields in the repeating table (e.g. Department) cannot get value from AD while some can. Why? How can I solve it? (I'm sure the fields are filled-in in the AD)
Hi Kenny,
This example take the info from MOSS User Profiles, so if the AD has the info but it was not synched to SharePoint you might not get the values...
You should look at the SSP in MOSS for the user profiles and make sure these properties are synched to AD. Than preform a full import to the user profile to see if the problem was resolved.
Good luck!
I would like to retrieve all users list to a droppdown list box entries. How can I handle that? Which is the right web service to call? And in which location?
Thanks for these great tips. I had bookmarked this page some time ago and all looked fine. Am I the only one, but now there are dead links for most of the screenshots.
Today is the gold für wow second day of 2009 ,world of warcraft gold it also a mesos special for me .cheap wow gold Because i have cheap maplestory mesos a chance to go to an english speech of LiYang and crazy to learn english follow him . He is a firendly,kindly person who make me feel good.wow gold kaufen What‘s more ,maple story mesos he very confidence .And he make me sure what he can do i also can do,as long as i make a determination and force myself to do it every second,Crazy just like him .wow geld I learn one setence from his book ever :maple story items If you want to succeed always force yourself to do more .I can't agree more with him .wow gold farmen To be honest ,when i was a littel girl i already fall in love with english.But what a pity i am poor in english ,Maple Story Account and it make me feel frustrating .So i want to give up many times ,but i can't as i still love it .So i tell mysefl :if you think you can you can wow leveling,and all your maple story power leveling hard work will pay off.wow power leveling Today i am very happy i can listien this wonderful speech of LiYang. I reap a great benifits from him .maple story money As he say :i am the best ,and every one can do it . world of warcraft power leveling Yes,i belive i can do it if i crazy as he
Does anyone know if I do this with MOSS2007 and Infopath 2003. Or do I need Office 2007 to do it.
Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =)THANX FOR
MAKING SUCH A COOL BLOG
Let me share with you a great resource,
Free Resume Examples
A collection of Free Resume Examples. This site have great Free resume format examples covers all professions of life with exact details and techniques as how to write professional looking resumes.
how to add a text field to allow the fx function to work?
It works great for me, however, the big ugly repeating table keeps showing up on my form. Is there a way to hide it?
Greate work dude, thank you very much
Thanks for the info. How would I pass a value to this so I could retrieve another users info. For example the current user's manager as identified in the SP profile?
Post a Comment