Microsoft & .NET.NETUser Profiles and Audience Targeting in SharePoint 2007

User Profiles and Audience Targeting in SharePoint 2007 content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Within any organization, a user is more than just the account he or she uses to log in to the network and the unique ID (for example, CustomerID, VendorID, or EmployeeID) he or she is assigned. A user has a name, a phone number, an address, a title, and maybe even a photograph and food preferences. An organization usually maintains such information in disparate databases. For instance, HR would have information such as emergency contacts and mailing address, whereas payroll may have tax and salary information.

This valuable information usually is locked away in systems that do not talk very well with each other. If all this information could be stored in one system, specific content could be targeted to specific users. So, for example, a new law that applies only to offices in California would be viewed only by users whose PositionState field is CA.

Microsoft Office SharePoint Server 2007 (MOSS 2007), or simply SharePoint 2007, provides just such a solution by introducing the concept of User Profiles. User profiles allow you to associate metadata with every UserID. In MOSS 2007, this metadata can then be kept in sync with the other systems in the organization using BDC, an Active Directory domain controller, or an LDAP server. Having such metadata from disparate systems aggregated and synchronized into one single system—MOSS 2007—presents a very valuable proposition to any organization.

It is quite reasonable to expect that a MOSS User Profile would be an amalgamation of information from various sources. Thus, MOSS provides you with the means to fine-tune such information and its import. This article examines the SharePoint 2007 User Profile feature, beginning with a discussion of what it takes to set up metadata.

User Profiles Setup

By default, SharePoint 2007 automatically detects the domain controller and imports the user information from the Active directory service. It is worth nothing that some subtle differences exist between Windows SharePoint Services (WSS) and MOSS (see the section at the end of the article). With the user information imported, instead of seeing “Welcome Domainsmalik” on the top left-hand corner on a SharePoint site, I would see “Welcome Sahil Malik” (see Figure 1).

Figure 1: Top Left-Hand Corner on a SharePoint Site

Clicking on the “My Settings” link in WSS shown in Figure 1 takes me to a page where I, the logged-in user, can maintain information about my own profile (see Figure 2).

Figure 2: Maintain Information About Your Own Profile

In MOSS, the end user can maintain this information in his or her “My Site” using the “Edit Profile” link.

Depending upon the specific network setup in your organization, you may not find all the information populated. You may want to add to the information shown in Figure 2. For instance, a “Mobile Phone” item would be nice for “Sales personnel”. The Mobile Phone information may be sitting inside a SAP system accessible via a web service/business data catalog connection.

User Profiles are managed through the shared service provider for a site. Under Shared Services, you will find a section for “User Profiles and My Sites”. You can manage User Profile information mainly using the first two links in that section as described in the following section.

User Profiles and Properties

Clicking on the “User profiles and properties” link takes you to a page where you can manage the Profile and Import settings, as well as the various properties you wish to maintain on user profiles.

In the first section on this page, Profile and Import settings, you can view existing profiles, set up import connections, add new profiles, and view current statuses and logs for the import process. You can configure the Shared Service provider to import user profile information from either Active Directory, a business data catalog. or an LDAP server. To do so, you would first have to create a suitable import connection and then specify a full import schedule and an incremental import schedule.

In the second section, you can configure the various User profile properties. Imagine that you were setting up MOSS for an organization that was spread across the United States and the UK, and one of the bits of user profile information you wanted to track was zip codes. Americans call them zip codes, but Brits call them postal codes. By using this second section of profile properties, not only can you add newer properties in a user profile, but you also can define a mapping between source and target. Thus, you can choose a common name (ZipCodes) to represent a piece of information that may have different names (ZipCodes vs. PostalCodes) in different systems. Not only that, but you can choose various other parameters of the property such as visibility, “editability” by the end user, whether or not the property is indexed for searches, which data connection is the specific property populated from in case you were amalgamating user profile information from disparate sources, and so forth.

Profile Services Policies

The second link under the “User Profiles and My Sites” section of the shared service provider is the “Profile services policies” link. Under Profile Services Policies, you will see a section titled “User Profile Properties” where, as the name suggests, you can specify a policy for each profile property. For instance, if you were tracking “Manager” information for any specific user, you probably wouldn’t want the user to be able to edit that. If you were tracking “Salary”, you probably wouldn’t want the user to edit that, nor would you want that information to be visible to the general public. However, a user’s birthday is something you want to be both visible and end-user editable. You can specify such policies for each user profile property using this section (see Figure 3).

Figure 3: User Profile Properties Section

Migrating User Profiles

Any good software development environment has development machines, a QA server, a staging server, and a production server. Your environment may also have multiple production servers. For instance, you may have MOSS running both on the intranet and the extranet. For security reasons, the extranet server may be set up on a physically separate machine that may not be able to communicate directly with the domain controller that sits inside the firewall. Also, it is quite possible that the development machines may be under different network topologies than the various servers in your network.

Thus, you need a way to set up user profiles on a server, and be able to migrate them easily to another physical machine.

User Profiles cannot be migrated using the SharePoint UI. However, like many other things in SharePoint, you can manipulate the profiles easily by using the SharePoint API. Currently, two open source command line utilities are available with full source code that will help you achieve this task:

  1. ProfilePropertyMgr: ProfilePropertyMgr is a utility for importing/exporting profile properties. Once you set up the specific properties you want to track on a specific SharePoint installation, you can export them to an XML file and then import the XML file into another SharePoint installation.
  2. Profile Importer (PI): PI is a utility that allows you to import/export actual user profile data between SharePoint sites and XML. So, if your intranet server has access to the domain controller, you can schedule an export of user profile data from the intranet server to an XML file, and an import from the XML file to the extranet SharePoint server.

Putting User Profiles to Use—Audience Targeting

User Profile information can be incredibly useful. You could write custom utilities on top of such information. For instance, you could provide an “Emergency Contact List” in the form of an Excel spreadsheet by simply reading user profile information. This list then could be interlinked with an emergency coverage schedule, thus allowing the end user to very easily track down the right individual for the right job, along with his contact information, just when he or she needs it.

Besides writing custom utilities to leverage User Profiles, a rather useful way to use user profiles out of the box is audience targeting. Audience targeting refers to the ability to create an audience based on a specific set of rules and then target content to a specific audience.

Before you can use audience targeting, you need to set up a rules-based audience first. Here is how you do so:

  1. Under the Shared Service provider for the web site, click the “Audiences” link under the “Audiences” section.
  2. You will see the number of audiences that exist in the system and a listing of relevant links to view or create audiences. Click “Create Audience.”
  3. Specify an audience, as shown in Figure 4.

    Figure 4: Specify an Audience

  4. On the next screen, add an audience rule as shown in Figure 5.

    Figure 5: Add an Audience Rule

  5. On the final page, you can add more rules, if you want, under the “Audience Rules” section (see Figure 6).

    Figure 6: Add More Rules

  6. When you are done adding the necessary rules, click the “Compile Audience” link in the section titled “Audience Properties.” You also can specify a compilation schedule on the main Audiences page. After an audience is compiled, you should see the relevant users that fall within the specified rules-based audience.

Once an audience is set up, you then can use the following steps to target content to the specified audience:

  1. In a list of your choice, go to List Settings, and click on “Audience Targeting Settings” under the “General Settings” section.
  2. Check the checkbox that Enables Audience Targeting as shown in Figure 7.

    Figure 7: Enable Audience Targeting

  3. Add a new item to the list. A textbox at the bottom allows you to specify “target audiences” for the new list item. For a list based on a calendar template, see Figure 8.

    Figure 8: List Based on a Calendar Template

    Now when you save this list item, targeted only to California employees, anyone who doesn’t match the rule specified for this audience will not see this content.

This is an incredible way to target information to a specific set of individuals. Even when users search, the system will consider audience targeting when retrieving search results.

User Profiles in WSS Versus MOSS

WSS has a People and Groups feature that keeps track of user information. However, it is a one-time sync from the Active Directory, which is initialized when that user is first accessed. You can add columns to the user info list, but they must be subsequently updated by hand. This user info is per-site, and the “My Settings” link takes the user to a page where this information can be maintained.

MOSS, on the other hand, has a User Profile feature that allows for synchronization from AD/LDAP/BDC stores at regular intervals. You can define properties and set various policies. Note that one of the options is “replicable”, which will cause the property values to be synchronized down to the WSS user info list. This is how many properties, such as picture and department, get added to the WSS page. Also, the normal entry point for users to edit their own profiles is via their My Site (“Edit Profile”) link. In the user’s profile, the user can edit his or her profile data, and set privacy settings as well if the admin policy allows him or her to do so.

Reigning in Information

Every single day, organizations struggle with better means to communicate information to individuals. Usually, the challenge lies somewhere between too much information because it is broadcast to everyone or too little information because there is no easy way to communicate effectively with everyone. In fact, studies have been done to demonstrate that a larger organization can spend thousands of dollars on a single email that says something like “The alarm is going off on the white Lexus in Building 31.” It is not that this message is unimportant—it is very important to the owner of the white Lexus, which is probably being broken into right now—but it still costs thousands of dollars in lost productivity if every other individual in the organization simply reads and deletes the email.

Also, information in various disparate systems that do not talk to each other tends to get out of date and out of synch. When used effectively, user profiles and audience targeting clearly provide a very significant value addition to any organization.

About the Author

Sahil Malik ( has worked for a number of top-notch clients in Microsoft technologies ranging from DOS to .NET. He is the author of Pro ADO.NET 2.0 and co-author of Pro ADO.NET with VB.NET 1.1. Sahil is currently also working on a multimedia series on ADO.NET 2.0 for Keystone Learning. For his community involvement, contributions, and speaking, he has also been awarded the Microsoft MVP award.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories