Tuesday, October 02, 2018

Using an Extranet Registration Receiver to Map External User Data in SharePoint




Registration Receiver

One of the first things that I do when I get something new is make it uniquely my own. When I got my new desk, I broke out the drill and installed a USB Hub. New car… seat covers and dice for my mirror. New house… paint every room in the house (ok, so that one was actually my wife’s choice) but I think there is something about customizing or personalizing that makes the experience feel special and unique in some way. Your SharePoint extranet powered by ExCM should be no different!

AD vs. HUIL

Most people who have worked with SharePoint for a while know that Active Directory is the default location that is used to pull user information from. What some do not know is that there is another list that can be populated by AD called the User Information List, or sometimes called the Hidden User Information List (HUIL). Typically this list is kept in Sync with Active Directory by the User Profile Service taking data from AD and adding it to the HUIL. In this article we will walk you though how to use this HUIL to store data about your external users. To access your HUIL, just browse out to;

For instance:


SP User Registration

When an internal user logs into a site collection, their First and Last Name is displayed in the top right corner. This information is stored in Active Directory for internal users. However, your Forms Based External Users are not stored in AD and therefore their user name is typically just their email address. We created the SPUser Registration Receiver to help personalize the experience for your external user and add their first and last name to the user information. The following code in the web application's web.config file is used to accomplish this for us.

<add name="SPUser" spUserFieldMap="Title=$registrationItem.FieldAnswers.get_Item('FirstName').Value $registrationItem.FieldAnswers.get_Item('LastName').Value;" type="SPSolutions.SharePoint.ExCM.ExtranetSPUserRegistrationReceiver, SPSolutions.SharePoint.ExCM, Version=3.0.0.0, Culture=neutral, PublicKeyToken=fdcedad4c93ea981" />



Assign a Department (built In)

Now that we know about the HUIL and have seen a registration receiver in action, let’s work through setting up our own custom registration receiver. For this example, we are going to add a new registration field and allow our end user to assign a department from a drop down list.

First, let’s create the registration field by adding a global registration field through the Global Application Settings menu of Extranet Collaboration Manager (ExCM). We could also create a registration field on an individual site collection, in case you have one site collection that you need to collect different information than the rest of your site collections

[Steps to add a drop down list to a registration page] 






Now that the field is there, let’s test to ensure that we did not break anything. We browse out to the site and register as Sally who is an external user and in the accounting department of her company.

Now that she is registered we browse out to the HUIL and see that she is added as a user in SharePoint but the department value did not show up. 







To correct this, we need to add some logic to our web.config file so that we map the answer to the “Department” registration field to the Department field in the HUIL

[steps to add department registration receiver]

Open the Web App’s web.config file by browsing out to the Virtual Directory (in our case C:\inetpub\wwwroot\wss\VirtualDirectories\extranet.awbikes.com80)

Make a backup copy of the web.config file

Search for <registrationReceivers>

Copy the following text and paste just above SPUser line:

<add name="SPDepartment" spUserFieldMap="Department=$registrationItem.FieldAnswers.get_Item('Department').Value;" type="SPSolutions.SharePoint.ExCM.ExtranetSPUserRegistrationReceiver, SPSolutions.SharePoint.ExCM, Version=3.0.0.0, Culture=neutral, PublicKeyToken=fdcedad4c93ea981" />

Save your web.config file.  SharePoint will automatically reload it into memory for you.  No IISRESET or reboot is required.


Now that we have the Department registration receiver in place, lets create a new user and test. We browse out to the site and register as Tom from the Accounting department



We can see that the user was created in SharePoint and now has the appropriate Department value listed, as chosen by Tom from the drop down box on the registration page:


Be sure to check out our next post on how to take this a step further and assign a photo based on a registration answer!

No comments: