SharePoint 2013 Active Directory Profile Picture URL Incorrect
-
03-10-2020 - |
Question
When user images sync from active directory the image url is https://example.com/sites/mysitesUser%20Photos/Profile%20Pictures/user_MThumb.jpg. I'm missing a slash after mysites. If I manually upload an image within CA it works perfectly. Has anyone run into this before?
La solution
Their are couple of ways to fix this kind of issue.
- Update the Mysite Host with trailing Slash i.e http://mysite/
- We can update this manually by going to user profile properties inside user profile service application and linking it to the correct picture.
Use the powershell to update this.
here is code:
$site = get-spsite "http://SiteCollection" $context= [Microsoft.office.server.servercontext]::GetContext($site) $userProfileManager = new-object Microsoft.office.server.userprofiles.userprofilemanager($context) $profiles = $userProfileManager.GetEnumerator() foreach ($profile in $profiles) { $Matchurl = "http://mysitehost/User PhotosProfile Pictures" #Provide the incorrect URL for the picture if($profile["pictureurl"].value -match $matchurl) { Write-host $profile["AccountName"].value "contains incorrect url" $CurrentURL = $profile["Pictureurl"].value $CurrentURL = $CurrentURL.tostring() $GoodUrl = "http://mysitehost/User Photos/Profile Pictures" #Provide the correct URL for the picture $CorrectUrl = $CurrentURL.replace($matchurl,$goodurl) $profile["pictureurl"].value = $correcturl $profile.commit() Write-host $profile["AccountName"].value "PictureURL has been corrected" } }
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange