| Lori 的个人资料See The Point日志列表 | 帮助 |
|
|
2月21日 Need Air? Open a New WindowThe I Need to web part is a great tool for giving users the ability to select an action from a list of common actions that they need to perform. The tool works from a custom list with the following columns:
Menu Choice (single line of text)
Filter Value (choice)
URL (hyperlink) - this field MUST be URL and it is case-sensitive.
Once you have your list, add the I Need to web part to a page. Since the web part defaults to the Site Directory, you will need to configure it. Click the edit drop-down arrow on the web part and select Modify Shared Web Part. Click the Change button, then select the list you have created. Set the filter field and filter value for the actions you want to include, modify the width if desired.
Now you have a web part on the page that will allow users to perform the specified actions. The only draw-back is, if the links are to actions in a different site collection, how do you get your users back to the site where your I Need to web part is? In order to do this, you need to force the I Need to web part to open the links in a new window.
The web part uses a function from portal.js. Don't modify this file! Instead, add a JavaScript to your page with a CEWP (Content Editor Web Part) that instead makes the function open in a new window.
1. Add a Content Editor Web Part to your page.
2. Open the tool pane to modify the web part.
3. Click the Source Editor button.
4. Type the following script into the Source Editor:
5. Click Save, then expand the "Layout" section of the tool pane.
6. Check the box next to "Hidden" and click OK.
Now your I Need to web part will open links in a new window and the user will be able to come right back to the site and perform other actions. 2月19日 Auto-Pop Life with InfoPath (Part 2 of 2)From the first part of this series, you now know how to use the User Profile Service from SharePoint to populate the currently logged in user's data within an InfoPath form. Which is great, but sometimes you need to populate data from another user. One of the first instances that come to mind is an off-boarding form with workflows built around the process of off-boarding employees. Combine the web service data connection with a Contact Selector web part throw in a few rules, and you have your solution. How?
Step 1: Add the Contact Selector control to InfoPath - this only has to be done once within InfoPath, then it will be available for future forms.
1. From the Controls task pane, click on "Add or Remove Custom Controls..." then click Add.
2. Select "ActiveX Control" then click Next.
3. Locate "Contact Selector" in the list, select it, then click Next.
4. Ensure "Don't install a .cab file" is selected, click Next.
5. Set the Binding Property to "Value", click Next.
6. In the drop-down menu for field or group type, select "Field or Group (any data type)" then click Finish.
7. Click Close, click OK.
Step 2: Add a data connection - this must be done for each new form created.
There is some preliminary work here, first you have to create an XML file and save it. Open notepad and paste: <Context siteUrl="http://<your site url>"/>. Save the file as Context.xml. This same file can be used each time you create a new data connection of this type.
1. In InfoPath click Tools>Data Connections, then click the Add button.
2. Select "Create a ne connection to:" and "Receive data", click Next.
3. Select "XML Document" and click Next.
4. Browse to the Context.xml file you created in notepad, click Next.
5. "Include the data as a resource file in the form template or template part" should be selected, click Next.
6. Leave the connection named "Context" and automatically retrieve the data when the form is opened, click Finish.
Step 3: Add the control to the form.
1. Drag and drop the control to the desired location on the form.
2. Go to the Data Source task panel.
3. Modify the data source so that the group that is created by the new control is exactly like the data source pictured. The "Person" group is a repeating group, the field names are case sensitive and must be exactly as shown below.
The control on the form that can be used to lookup users in Active Directory. Which is pretty nice if the DisplayName and Account ID are all the information that is needed. Here's how to get more:
Step 4: Add your rules.
1. While in the Data Source task pane, create a field in the main data source (but not in your Contact Selector group) and name it something meaningful. I use HiddenAccountName to keep it distinct from the field in the Contact Selector group.
2. Click the drop-down menu on your data field in the data source, click "Properties", then click the function button to set the default data.
3. Click "Insert Field or Group..."
4. Select the AccountId field from your contact selector group, then click OK on each window until the Field or Group Properties is showing(2 times).
5. Click the Rules and Merge tab, click Add.
6. Don't set any conditions, this rule always applies, click Add Action.
7. Select "Set a field's value" from the drop down.
8. Click the data source button next to the "Field" field.
9. Select the data source you wish to use for the lookup in the drop-down menu. *Be sure you don't re-use the connection for the current user data if you have one in this form.
10. Expand the query fields and sub-groups, then select "Account Name", click OK.
11. Click the function button next to the "Value" field, then click Insert Field or Group.
12. Select the current field you created in step 1 above, click OK until all windows are closed (3 times).
13. In the data source pane, use the drop-down menu to select the data source that you will use to look up another user's profile information.
14. Expand the query fields and all sub groups until the field AccountName is visible. Click the drop-down menu on the AccountName field, then click properties.
15. Click on the Rules and Merge tab, then click Add.
16. Do not set any conditions, this rule will always apply. Click Add Action.
17. Select "Query using a data connection" from the drop-down menu.
18. Select the data connection you wish to use for the lookup from the drop-down menu (it should be the same as the data source listed in the task pane), then click OK.
19. Click Add Action.
20. Select "Set a field's value" from the drop-down.
21. Click on the data source button next to the "Field" field.
22. Ensure you change the data source to "Main" and select the field you wish to auto-populate, then click OK.
23. Select the function button next to the "Value" field, then click Insert Field or Group.
24. Expand the data fields group and all sub-groups, select "Value", click Filter Data, then click Add.
25. Where the "Value" field is defaulted, click the drop-down and select "Select a field or group..."
26. Select the "Name" field under "Property Values", click OK.
27. In the third field, click the drop-down and select "Type Text".
Repeat steps 19 through 28 for all fields that you wish to have auto-populate with the other user's data. It is important that "Query using a data connection" remain the first action. If it is not the first action, highlight that action and move it up until it is the first.
29. Click OK on all windows until you are back to your form.
Now you have a contact selector that allows a user to look up another user in AD and have their profile properties auto-populate fields on the form. 2月17日 Auto-Pop Life with InfoPath (Part 1 of 2)Forms are everywhere. You would be hard pressed to find some sort of business process that doesn't involve the use of some form. Developing InfoPath forms can be done to make many processes electronic. Combine the power of InfoPath 2007 with SharePoint's InfoPath Services and you can really make some dynamic forms with workflows to automate complex business processes.
So, lets say you have designed an InfoPath form that is a request form. What do your users want you to do? Make the process faster! What is the easiest way to do that? Make as many fields auto-populate as possible. What InfoPath combined with SharePoint's User Profile Service does is allow you to populate user information with no code! This means that the end user doesn't have to enter their information when you already have it populated in Active Directory (AD).
To get the current user's information:
1. Open InfoPath 2007 and click Design a Form Template.
2. You can choose to design from a blank form, one you have already created, or customize a sample.
3. Click Tools>Data Connections, then click Add to add a new connection.
4. Ensure "Create a new connection to:" is selected and select the radio button next to "receive data" then click Next.
5. Web Service should be selected, that is what the User Profile Service is, then click Next.
6. Enter the following address for the web service: http://<your site here>/_vti_bin/UserProfileService.asmx then click Next.
7. A list of options for the data will be shown, scroll down and select GetUserProfileByName, click Next.
8. Do not change the parameters, click Next.
9. Do not check "Store a copy of the data in the form template", click Next.
10. Ensure "Automatically retrieve data when the form is opened" is checked. You can change the name of the connection if you desire. Then click Finish.
Now you have this data connection, but that is a lot of work, right? Let's make it easier for future forms. We can take this connection and convert it to a universal data connection and store it in a library within SharePoint to be used in other forms. Leave your Data Connections open, in your SharePoint site, create a Universal Data Connection Library. Site Actions>Create (or View All Site Content>Create), select Data Connection Library from the Libraries list, title it and set the navigation and versioning as preferred.
Now, back to InfoPath.
11. Ensure that the data connection you created is highlighted and click Convert.
12. Enter the URL of the library (or browse to it) and the filename of the connection. Make it meaningful to you and don't forget the .udcx file extension.
13. For most power users who may create forms, select the "Relative to site collection (recommended)" option, click OK. This means that any forms posted within that site collection can utilize this single data connection that has already been created.
You will need to go to the Data Connection Library and approve the connection before publishing your form. For future forms, you only need to create a new data connection, select "Search for connections on a Microsoft Office SharePoint Server". Select your site (or manage sites to add your site to the drop-down), expand the data connection library, select your connection and then continue through setting up the data connection.
Alright, now we have this data connection, how do we use it to auto-populate fields in the form?
1. Double-click on any text box (or add one to your form) to adjust the properties.
2. In the default value field, click on the function button.
3. Click "Insert Field or Group".
4. Select your data connection from the drop-down menu, click OK.
5. Expand the "data fields" and all sub-folders until you can select the "Value" field, then click "Filter Data".
6. Click "Add" to create a new filter.
7. Where the "Value" field is defaulted, click the drop-down and select "Select a field or group..."
8. Select the "Name" field under "Property Values", click OK.
9. In the third field, click the drop-down and select "Type Text".
10. Type the property from the user profile that you wish to enter in the field, then click OK until you are back at your form.
11. Repeat this process on all of the fields that you want to auto-populate.
Below are some of the more common properties that you can filter on to populate your form. This is not an exhaustive list, but you can look at the Profile Properties that are defined within your Shared Services Provider for more.
AccountName
FirstName LastName PreferredName WorkPhone Office Department Title Manager UserName WebSite PublicSiteRedirect Assistant WorkEmail CellPhone Fax HomePhone So, now you can have a request form that auto-populates data about the current logged in user who is completing the form. All without writing a single line of code! Stay tuned, tomorrow I will show you how you can take this data connection and combine it with another InfoPath control to auto-populate data for users other than the currently logged in user.
|
|
|