Freigeben über


SharePoint 2013 Profile Pictures no longer display in MySites after moving MySite URL or changing web applications

You may have run into this innocently enough, just trying to get a better URL for your MySite users. Or you have migrated and, for whatever reason, had to use a new URL for MySites. 

For example: your MySite Host was https://portal.company.com and you have changed it to https://personal.company.com. Any change to the URL will cause the issue.

Once you migrate your MySite host to a new web application with a new URL or maybe just unextend/re-extend the web application to a different URL, you will notice that your user's profile pictures are no longer accessible, and look like this:

 

 

The Cause:
-----------------------
When you import pictures from Active Directory and run this command:

Update-SPProfilePhotoStore -MySiteHostLocation https://MySiteHost -CreateThumbnailsForImportedPhotos $true

All of the imported pictures that are currently in the metaverse get thumbnails generated and placed in this location:
https://MySiteHost/User%20Photos/Profile%20Pictures/

The location of the <username>_MThumb.jpg that gets generated, is stored as a PictureURL property in the user’s Profile.

Incidentally, the <username>_LThumb is the one used on the MySite “About Me” page, while _MThumb is the URL that gets stored in the profile properties.

Now that the MySites are hosted under a new URL, the old URL location of the profile pictures is not valid. Running another profile sync and running the Update-SPProfilePhotoStore command again to populate the thumbnails does not bring the pictures back, and you will see errors like this in the Application log in Event Viewer

 

Source:        FIMSynchronizationService

Event ID:      6110

Event ID:      6110

The management agent "MOSS-UserProfile" step execution completed on run profile "MOSS_FULLIMPORT_78fc6e7d-92a5-421a-a2f0-79a4250f42f3" but the watermark was not saved.

 

Log Name:      Application

Event ID:      6803

Level:         Error

The management agent "MOSS-UserProfile" failed on run profile "MOSS_FULLIMPORT_78fc6e7d-92a5-421a-a2f0-79a4250f42f3" because the server encountered errors.

 

Log Name:      Application

Event ID:      6801

Level:         Error

The extensible extension returned an unsupported error.

 The stack trace is:

 

 "System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.10.103.219:8000

   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

   --- End of inner exception stack trace ---

   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)

   at System.Net.WebClient.DownloadData(Uri address)

   at Microsoft.Office.Server.UserProfiles.ManagementAgent.ProfileImportExportExtension.DownloadPictures(ProfileChangeData[] profiles, Boolean delayErrors)

   at Microsoft.Office.Server.UserProfiles.ManagementAgent.ProfileImportExportExtension.Microsoft.MetadirectoryServices.IMAExtensibleFileImport.GenerateImportFile(String fileName, String connectTo, String user, String password, ConfigParameterCollection configParameters, Boolean fFullImport, TypeDescriptionCollection types, String& customData)

Forefront Identity Manager 4.0.2450.49"

 

As well as ULS errors like this:

01/13/2014 15:04:50.00 miiserver.exe (0x138C) 0x1B54 SharePoint Foundation General adyrv High Cannot find site lookup info for request Uri https://sp:8000/User Photos/Profile Pictures/user2_MThumb.jpg.   

 

Solution:

----------------------------------------

To correct this problem, you will need to re-base all of the profile picture URLs stored in the users’ profiles. I have seen a very compelling powershell method for this, using some good logic here, but there is an easier and completely out of the box way of doing this.

We will use our handy Update-SPProfilePhotoStore command again, but this time, for a different purpose.

Update-SPProfilePhotoStore -MySiteHostLocation <SPSitePipeBind> -OldBaseUri <Uri> -NewBaseUri <Uri>

In my test example, I moved my mysite host from https://sp:8000 to https://sp:8001, and this is the command that I ran:

Update-SPProfilePhotoStore -MySiteHostLocation "https://sp:8001" -OldBaseUri "https://sp:8000/User Photos/Profile Pictures/" -NewBaseUri "https://sp:8001/User Photos/Profile Pictures/"

UPDATE! I recently did some deeper investigation into this command and found that you don't need to specify the library or folder name here. PowerShell won't complain, but it also doesn't care. The values of the Library and Folder names (/User Photos/Profile Pictures/ for English-US language webs) are hard coded in the product and cannot be changed. The command should look like this:

Update-SPProfilePhotoStore -MySiteHostLocation "https://sp:8001" -OldBaseUri "https://sp:8000" -NewBaseUri "https://sp:8001/"

NOTE: The purpose of the command is ultimately just to update the photo URLs to your new Mysite host location, and cannot be used to place them in a different relative path - i.e., a different library or folder name.

This will re-base all of your incorrect PictureURL properties in your user Profiles, and now all of the picture thumbnails which are already present in the MySite Host will show up properly.

Enjoy!

Comments

  • Anonymous
    September 26, 2014
    Thanks, It resolved the issue.
  • Anonymous
    September 14, 2015
    Thanks! From an experienced .Net Developer, but a lost in the wilderness Sharepoint newbie.
  • Anonymous
    October 15, 2015
    Thanks Mike. This was really helpful and simple.
  • Anonymous
    February 04, 2016
    This is awesome, saved me a lot of time. Thanks!
  • Anonymous
    February 28, 2017
    I got messed upAfter this procedure my photos url are pointing to src="http://alibaba:80/my/my/myUser Photos/Profile Pictures/xyz_MThumb.jpg"and not to http://alibaba:80/my/my/myUser Photos/Profile Pictures/xyz_MThumb.jpg">
  • Anonymous
    February 28, 2017
    I got messed up.My pictures urls are now pointing to http://alibaba:80/my/my/myUser Photos/Profile Pictures/xyz_MThumb.jpg" and I pretended http://alibaba:80/my/User Photos/Profile Pictures/xyz_MThumb.jpg"