Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
SharePoint 2013 ActiveDirectoryImport Property Mapping through PowerShell - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

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()
}

 

(Visited 49 times, 1 visits today)

About the author 

Thomas Radman

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.