Question

we needed to restore the user profile pictures and succesfully did so. We copied all the images back to the "MySite/User Photos" library and ran the following script to map the images to the users:

$siteurl = "mySiteHost"
$site = New-Object Microsoft.SharePoint.SPSite($siteurl)
$context = [Microsoft.Office.Server.ServerContext]::GetContext($site) users
$upm = New-Object 
Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
if ($upm.UserExists($username)) {
        $profile = $upm.GetUserProfile($username)
        $profile["PictureURL"].Value = ("https://mysite.bauer-de.bauermedia.group/User%20Photos/Profilbilder/" + $file);
        $profile.Commit();
}

This worked but the images now have the wrong dimensions. When I upload my picture from the mysite, it shows as a quadrat. But when I see the images updated with PowerShell, it shows as the same dimensions, the original picture has.

Any suggestions how to fix this without re-uploading the image via User Profile Management manually?

edit: Nevermind. We mapped the MThumb.jpg instead of LThumb.jpg and now it works.

Was it helpful?

Solution

Generally, you can run Update-SPProfilePhotoStore to fix up the photo sizes after an update like this.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top