Archive for September, 2009

Lori’s Infopath tip: You can auto-populate another user’s profile info

For much of the past few weeks, I thought it wasn’t possible to auto-populate fields in Infopath using the Contact Selector ActiveX control, beyond the three standard fields it comes with (DisplayName, AccountId, and AccountType). I needed to populate my InfoPath form with WorkEmail and Department attributes, but it seemed that the only reliable way to do it was via code.

That is, until I got it to work using Lori Gowin’s post (see here: http://seethepoint.spaces.live.com/blog/cns!CDB633EE9271C6FA!163.entry?sa=608624574)

Lori’s new blog URL: http://www.pointgowin.com/SeeThePoint/default.aspx

I’m re-posting Lori’s steps here for posterity (just in case her blog mysteriously disappears…). I’ve also added an initial step to set up a connection to UserProfileService which is needed for the controls to work properly.



Adding a Contact Selector control to auto-populate another user’s profile details in InfoPath


Step 1: Add a connection to the UserProfileService.

1. Click on Tools > Data Connections > Create a new connection. Select “Receive data”, click Next.
2. Select “Web Service” and click “Next”.
3. Enter UserProfileService URL (enter your server name here):

http://SERVERNAME/_vti_bin/userprofileservice.asmx

click Next

4. Select “GetUserProfileByName” method and click Next.
5. At the next screen, leave default values intact and click Next.
6. At the next screen, leave default values intact and click Next.
7. Enter a name for this data connection, for example “GetOTHERuserProfileByName”.
Make sure to UNCHECK “Automatically retrieve data when form is opened” checkbox. Click Finish.

Step 2: 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 3: 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://”/&gt;. 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 4: 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.

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 5: 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”.
28. Type the property from the user profile that you wish to enter in the field, then click OK until you are back to the “Rule” window (5 times).
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.

Advertisements

Creating search scopes for a specific site collection

Problem:

You’ve created a site collection in your SharePoint farm, and now you want to create a search portal for it. You want to return results only from this site collection. How do we do this?

Note: This post assumes you are using MOSS 2007 SP2.

Solution:

There are a number of ways to address this issue, but here’s one way to do it:

1. Create a search scope, limited to your new site collection. Login to Central Administration > Shared Services Provider > Search Administration > Scopes. Click on “New Scope”. Enter scope title and description and click OK.

Scopes1

2. Return to the “View scopes” screen, click on the scope that you’ve just created, and click on the “New Rule” link. Select “Web address” radio button, and enter the address of your site collection in the “Folder” text field. Click OK. Your new scope is ready and will update in about 10 minutes.

Scopes2

3. Now we’re going to associate the scope with your site collection. Navigate to your site collection, go to Site Actions > Site Settings > Search Scopes. First, click on “Display group: Search Dropdown”.

scopes3

4. In the “Edit Scope Display Group” screen, uncheck all scopes except the one you’re trying to associate with the site collection. Repeat the process for the “Advanced Search” display group.

scopes4

5. Next, we need to create a new search portal site or add a search box to an existing site. To create a new site, go to Site Actions > Site Settings > Sites and Workspaces and create a new site using a Search Center template (under Enterprise tab). For existing sites, you can add the Advanced Search box and customize it to fit your needs:

scopes5

6. Test your portal using sample documents located inside and outside the site collection. You’ll need to re-run your SSP content source crawls in order to search for newly added content.

Installing Microsoft Office Project Server 2007 on Windows Server 2008 SP2

If you try to install Project Server 2007 on Windows Server 2008 with Service Pack 2, the Setup program will give you an error message such as this one:

“The program is blocked due to compatibility issues.”

The solution for this error is the same as the solution for a similar error with SharePoint Server 2007 – you need to slipstream the latest service pack files into your Project Server installation (the SharePoint solution was described by Martin Kearn here.)

To successfully load Project Server 2007 on Windows Server 2008 SP2, follow these steps:

1. Copy Project Server 2007 installation files from the CD to a local directory on your hard drive, such as C:\Project2007.

2. Download Project Server 2007 SP2 files from this location:

http://www.microsoft.com/downloads/details.aspx?FamilyID=b7816d90-5fc6-4347-89b0-a80deb27a082&displaylang=en.

Choose the appropriate download for your architecture (32-bit or 64-bit).

3. From the command prompt, extract the update files to a local folder using /extract switch. Example: c:\ProjectServer2007sp2-kb953334-x86-fullfile-en-us.exe /extract:c:\Project2007SP2\

4. Copy the extracted SP2 files to /Updates directory in the Project Server 2007 installation folder on your hard drive.

5. You can now install Project Server 2007 on Windows Server 2008 SP2.

How to deploy administrator-approved InfoPath form templates

Excellent post describing how to deploy administrator-approved form templates from InfoPath application into SharePoint (with screenshots):

http://www.infopathdev.com/blogs/janice/archive/2009/03/03/administrator-approved-form-templates.aspx

Note: You can only use this process for browser-compatible InfoPath forms.

List of SharePoint web services

I was looking for a comprehensive list of web services available in MOSS. After much searching, I found this list:

http://msdn.microsoft.com/en-us/library/bb862916.aspx

Mark Wagner has a list on his site as well:

http://www.crsw.com/mark/sharepoint/Wiki%20Pages/SharePoint%20Web%20Services.aspx

This page has a nice summary of what each webservice does and how to incorporate them into your project (the list was originally created for SPS 2003, but most web services still apply for MOSS 2007):

http://www.csharphelp.com/archives4/archive602.html

Using the Contact Selector Control

The Contact Selector control is a special ActiveX control which can be embedded into InfoPath forms to allow lookups of Active Directory users.  This would be useful in cases when the person filling out the form needs to access the account properties of another user – for example, a manager filling out a helpdesk request for one of her employees.

This InfoPath team blog post contains some critical details necessary for proper configuration of this control:

http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx


RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 356,734 hits