2013-11-23

When I first heard of the new option in SharePoint 2013 for importing user properties directly from Active Directory, without using FIM (Forefront Identity Manager), I was quite happy. There happened to be a massive improvement in terms of performance as well.

I usually have most of the basic configuration of my SharePoint farms be performed by scripts, so I started to adapt the script for creating the sync-connection, user properties and property mappings. At first hand it seemed to me, that there was a big hole in the implementation. The methods of the classic sync-connection did not work. The Connection.PropertyMapping property was always NULL and the regular methods for adding a property mapping did not work. Well, at least that was documented on TechnNet. ( http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.connection.propertymapping.aspx )

But, once I figured out that ActiveDirectoryImport also got some new methods, everythings worked out fine. By using the ActiveDirectoryImportConnection.AddPropertyMapping method it also got much easier.

Try this yourself:

$site = New-Object Microsoft.SharePoint.SPSite <centraladmin-URL>
$context = [Microsoft.SharePoint.SPServiceContext]::GetContext($site)
$configManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager $context
$UPAConnMgr = $configManager.ConnectionManager
$Connection = ($UPAConnMgr | select -First 1)
if ($Connection.Type -eq "ActiveDirectoryImport"){
  $Connection.AddPropertyMapping("streetAddress","SPS-Location")
  $Connection.Update()
}

 

About the author 

Thomas Radman