Peter Holpar has a very good article on this topic as it relates to SharePoint 2010. Generally speaking, it's very much the same in SP 2013. If the property is just going to be populated once from the WCF service and then SharePoint will be the owner of the property (i.e. where people go to update it) then you do not need a BCS model or the sync connection. You could just write a script or console app that does a one time population of the properties in question.
If the WCF service's datasource is still going to be the canonical source for the data, then I would probably manually create the sync connection.
Process - No Code
- Create and deploy your BCS model. Your model must contain a property that maps to a unique identifier in AD. I used the SAM Account Name without the domain prefix, i.e.
- Create the sync settings/properties.
- From the Manage Profile Service page click Manage User Properties.
- On the User Properties page either find the property you wish to modify or add a new property. In this example I have chosen to edit the
Department property. Most of these attributes are pretty self-explanatory.
- At the bottom of this page ensure that there is nothing listed under
Property Mapping for Synchronization. If there is, click remove.
Add new mapping select your BCS connection for
Source data connection and then pick the property from the BCS entity that you wish to map to this user profile property. Don't forget to click add and then OK.
Go back to the Manage Profile Service page and select
Configure Synchronization Settings. Be sure that
Include existing BCS connections for synchronization? is checked as in this image. I didn't do this initially and it took me 30 minutes to figure out what I was doing wrong.
- Once you have completed that final step you can return to the Manage Profile Service page and click
Start Profile Synchronization. Once the sync completed you should see the new property/value on the
About me section of the profile page if you have enabled that attribute when you configured the property.
Process - Server OM
Here is some example code for creating a property. This was kind of hard to get working. I created a simple console app to create the property and the connection. One issue that I had before I got it working was that I kept getting a
NullReferenceException that was caused by a
SecurityException because my account (the account running the code) was not configured in both the administrators and permissions sections of the User Profile Service in Central Admin.
At this point, I am so tired my eyes are spinning, so if there are any typos here, feel free to correct them, or add a comment and I will make the correction.
//Get a handle on the central admin site collection as site
SpServiceContext context = SPServiceContext.GetContext(site);
UserProfileConfignanager userProfileConfigManager = new UserProfileConfigllanager(context);
UserProfileManager userProfilemanager = new userProfileManager(context);
ProfilePropertytianager propManager = userProfileConfigManager.ProfilePropertylianager;
CorePropertyManager corePropManager = propManager.GetCoreProperties();
CoreProperty coreProp = corePropManager.Create(false);
//The bool above is for isSection, which this is not.
coreProp.Name = "MyBcsFullName";
coreProp.DisplayName = "MY BCS Full Name";
coreProp.Type = PropertyDataType.StringSingleValue;
coreProp.Length = 50;
//Obviously it’s a user type
ProfileTypePropertyManager typePropManager = propManager.GetProfileTypeProperties(Profilerype.User);
ProfilesubtypePropertyManager subtypePropManager = userProfilemanager.DefaultProfileSubtypeProperties
ProfilesubtypeProperty subProp = subtypePropManager.Create(typePropManager.GetPropertyByName(coreProp.Name));
subProp.IsUserEditable = false;
subProp.DefaultPrivacy = Privacy.Public;
Connection connection = userProfileConfigManager.ConnectionManager["BCS Properties"];
if (connection != null)
PropertyMapCollection propMapCollection = con.PropertyMapping;
PropertyMap propMap = propMapCollection[subprop.Name];
if (propertyMap == null)
propMapCollection.AddNewMapping(ProfileType.User, subProp.Name, "FullName");
//The final param is the name of the property in the BCS model.
To the right, you will see the property we added.