Show SharePoint User Profile Image Without My-site Login

Standard

 Assume that you have a team site in the following URL http://myteam.example.com and you have my-site web application at the following URL http://mysite.example.com.

 When you open your team site at http://myteam.example.com without login to my-site, all users’ profile images will be shown as a cracked images until you logged into my-site web application or the windows authentication will be requested twice for the same reason.

 The problem behind that is that the users’ profile images will be added to html with my-site web-application URL such as

<img src=”http://mysite.example.com/User%20Photos/Profile%20Pictures/useraccountnameThumb.jpg&#8221; />

 Even if single sign on has been configured via ADFS or other trusted providers user must open both of them in two different tabs in order to display it as ADFS doesn’t support cross-domain resource sharing

 SharePoint 2013 have an awesome configuration that can change this default behavior and solve the problem as following:

  1. Remote login to your SharePoint server
  2. Open SharePoint Management PowerShell as administrator
  3. Run the following command after modifying it with your correct URL

    $web = Get-SPWebApplication http://myteam.example.com
    $web.CrossDomainPhotosEnabled = $true
    $web.Update()

  4. Open your site again and the problem will be solved

 Actually if you inspect the user profile image it will be shown in a different way than before as following

<img src=’http://myteam.example.com/_layouts/15/userphoto.aspx?size=S&url=http://mysite.example.com/User%20Photos/Profile%20Pictures/useraccountnameThumb.jpg&#8217; />

 You can imagine that as a local proxy for users’ profile images

Note: For other resources (not users’ profile images), you can add a hidden iframe to provide the authentication behind the scenes but you have to configure Single sign on to provide an excellent user experience

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s