3

Will SharePoint 2016 Active Directory Import support Profile Pictures now? In the past the answer to getting Pictures has been to "Use Profile Synchronization" not "Active Directory Import". Now FIM has been removed from SP 2016, and Microsoft Identity Manager 2016 doesn't support SharePoint 2016 yet, just SP 2013.

I'm using the SP 2016 RTM installation right now for testing, and pictures do not import. Anyone know anything further about how to import pictures in SP 2016?

Thank you!

4

You can configure SharePoint 2016 to import Active Directory properties to user profiles via Central Admin > Manage Service Applications > User Profile Service Application > Configure Synchronization Connections.

The synchronization connection will import numerous Active Directory properties. Unfortunately, user photos are not one of the properties. I have no idea why- it's an AD property like anything else, except it's binary, not text.

The Install Microsoft Identity Manager for User Profiles in SharePoint Server 2016 TechNet article explicitly states the built in Active Directory Import "does not import user photos" and recommends Microsoft Identity Management Server (MIM) instead.

The article states the built in Active Directory Import has the advantage of "not need[ing] a separate server installation," which implies the MIM server should be installed on a separate server.

I was not happy with the prospect of creating another VM to install MIM just to sync user photos. So I wrote a PowerShell script instead that syncs user photos from AD to SharePoint. Run this script on a SharePoint server.

First, install the AD PowerShell module.

Install-WindowsFeature RSAT-AD-PowerShell

Then run the script.

# Import AD module and set constants.
Import-Module ActiveDirectory
$domain = 'YourDomain\\' # Escape the backslash character
$mySitesUrl = "https://mysites.yourdomain.com"
$photoLibraryName = "User Photos"
$photoLibraryFolderName = "Profile Pictures"
$global:photoPropertyName = "PictureURL"
$global:directory = $PSScriptRoot + "\User Photos"


function SyncPhoto($web, $photoLibraryFolder, $username, $userProfile)
{
    Write-Host -NoNewline "Searching for $username in Active Directory... "
    $user = $(try {Get-ADUser $username -properties thumbnailPhoto} catch {$null})
    if ($user)
    {
        Write-Host "found."
        if ($user.thumbnailPhoto)
        {
            Write-Host -NoNewline "Downloading user photo... "
            # Download photo from Active Directory.
            $photoFilename = $username + ".jpg"
            $photoPath = $global:directory + "\" + $photoFilename
            $user.thumbnailPhoto | Set-Content ($photoPath) -Encoding byte
            Write-Host "done."
            Write-Host -NoNewline "Uploading photo to SharePoint..."
            # Upload photo to SharePoint My Sites.
            $photoUrl = $photoLibraryFolder.Url + "/" + $photoFilename
            $photoAbsoluteUrl = $mySitesUrl + "/" + $photoUrl
            $photo = Get-Item $photoPath
            $photoStream = $photo.OpenRead()
            $spFile = $photoLibraryFolder.Files.Add($photoUrl, [System.IO.Stream]$photoStream, $true)
            Write-Host "done."
            $photoStream.Close()
            # Update user profile
            Write-Host -NoNewline "Updating user profile..."
            $userProfile[$global:photoPropertyName].Value = $photoAbsoluteUrl
            $userProfile.Commit()
            Write-Host "done."
        }
        else
        {
            Write-Host "No photo found."
        }        
    }
    else
    {
        Write-Host "not found."
    }
    Write-Host ""
}


# Create local photos directory.
New-Item -ItemType Directory -Force -Path $directory | Out-Null


# Locate photo library in SharePoint My Sites.
$site = Get-SPSite -Identity $mySitesUrl
$web = $site.RootWeb
$photoLibrary = $web.Lists[$photoLibraryName]
$photoLibraryFolder = $web.GetFolder($photoLibraryName + "/" + $photoLibraryFolderName)


# Iterate over all SharePoint user profiles.
$serviceContext = Get-SPServiceContext -Site $site
$userProfileManager =  New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
$userProfiles = $userProfileManager.GetEnumerator()
while ($userProfiles.MoveNext())
{    
    $userProfile = $userProfiles.Current
    $username = $userProfile.AccountName -replace $domain -replace ""
    $photoUrl= $userProfile[$global:photoPropertyName]
    if ($username)
    {
        SyncPhoto $web $photoLibraryFolder $username $userProfile
    }
}
3

You'll need to use Microsoft Identity Manager. MIM does support SharePoint Server 2016 today. I'm not sure where you got the no-support information from.

You can find information you need to set up MIM for Profile Synchronization at https://github.com/OfficeDev/PnP-Tools/tree/master/Solutions/UserProfile.MIMSync.

More complete step-by-step instructions are available at https://thesharepointfarm.com/microsoft-identity-manager-series/.

And to provide completeness, as Waqas' link doesn't provide a fully working solution, you must implement the following https://thesharepointfarm.com/2016/05/additional-powershell-required-for-mim/.

  • Note that the last step ($sa.NoILMUsed = $true) is no longer required as of February 2017 Public Update. – Jussi Palo May 30 '17 at 6:45
  • I do recommend Erik Madsen's PowerShell script below instead of MIM, if you're only importing pics from AD to SP. MIM sync tends to have issues and fixing those isn't straightforward. – Jussi Palo Oct 12 '18 at 14:02
0

No, it will not. there is no improvement from SharePoint 2013 to 2016 in this area. Still not supported.

To import the profile pictures you can use the Microsoft identity manager. http://krossfarm.com/?p=148

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.