Using InfoPath and SharePoint to Create Personalized Views
Systems know who you are, but
This approach will let you create a form that is aware of a user's identity (login name, phone number, display name, etc.) and then allows you to filter a list in
Part 1: Find Out Things About Somebody
The first part requires
§ Create or modify your InfoPath solution.
§ Make sure that the data source for the form contains all of the fields that you want to store about the user (e.g. DisplayName, WindowsAccount, Title, email, PhoneNumber, etc.). Make sure you have at least an “alias” field. This will be the field on which the query is based.
§ Then add a new data connection by selection Data Connections from the Tools menu.
§ Click Add,
§ choose Receive Data, click Next,
§ choose Web Service, click Next
§ For the URL specify http://[MyPortal]/_vti_bin/UserProfileService.asmx?WSDL where [MyPortal] is the name of your
§ Choose GetUserProfileByName, click Next
§ Don’t specify a value for the input parameter, click Next
§ Deselect “Automatically retrieve data when form is opened”, click Finish
Now you are ready to query the web service and map return values to values in your form. If you haven’t already laid out your form, do so, and make sure to include the alias form field. Add a button next to the alias form field. Double-click on the button to go to its property dialog. Click on the Rules button. Set the condition to be when the alias field is not blank. Add an action to set the value of the secondary data source’s query field to be equal to the value of the alias field. Add another action for each of the fields you want to map where you set the form field’s value equal to the value of the return set. Make sure that you store the AccountName return value, this will be the basis of your
Publish the form solution to a
Step 2: Filter the List Based On The Current User
As you may already know,
Here is the relevant information from the article:
2. On the Data menu, click Filter.
3. Click Click here to add a new clause.
4. Modified Step: Click the field that you promoted to a column from the InfoPath solution from the Field Name column.
5. Click Equals in the Comparison column.
6. Click [Current User] in the Value column.
7. Click OK.
8. In the lower right corner of the edit window, click Code.
9. On the Edit menu, click Find.
10. Type Name="UserID" Location="CAMLVariable" in the Find What box, and then click Find Next.
11. This will find the following line of HTML code:
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
12. Change the line of HTML code to the following:
<ParameterBinding Name="UserID" Location="ServerVariable(LOGON_USER)" DefaultValue="[ LOGON_USER ]"/>
13. Save the page, and then click Preview at the bottom of the edit window.
Part 3: Validating
§ Fill out a form,
§ specify your own alias,
§ lookup your information using the button,
§ save it to the
§ do this again only using a different user’s alias,
§ visit the filtered view, and confirm that only your form shows up.
If you have any problems or if this process isn't clear, leave a comment.