0

I have created SharePoint Hosted App. I am loading current user profile data from user profile service. When loading the image using PictureURL property image loading fail.

  1. Tried directly using the PictureURL which points to mysite user photos location.
  2. Tried using host web layouts userphoto.aspx url.

But both scenarios failed to load the profile picture. I have understood this issue is because of cross domain url.

Please help how to solve this problem.

-Praveen.

2

I faced the same issue. My experience was even if you have CrossDomainPhotosEnabled set to TRUE, then also option 1 (PictureURL from MySite) won't work unless you access that URL once in your browser.

I found option 2 better as cross domain call to host web is allowed by default. Though, option 2 takes some time to reflect.

Check this link for more detailed information

  • So, there is no other way to get the profile picture then. I am not sure why the host web url is not allowed in hosted apps. – Rare Solutions Jan 21 '15 at 6:21
  • It is allowed. Please go through the attached link once. You can show profile pic in app – Garima Jan 21 '15 at 6:33
  • Garima, I have clearly explained scenario 2 in my post. I have tried using the host web url to layouts userphoto.aspx. But, the images are not loading. It gives me cross mark. But the same works fine in App Part. IF I type the url directly then the url redirection happening to login.microsoftonline.com which means it still looking for authentication. I am using IE 11 and Chrome. – Rare Solutions Jan 21 '15 at 9:25
  • Could you share the userphoto.aspx url with me? I am using the same in my SP hosted app and it is working. – Garima Jan 21 '15 at 10:50
  • See mine here. companyname.sharepoint.com/_layouts/15/… – Rare Solutions Jan 30 '15 at 12:30
0

SharePoint team has added a new feature to SharePoint that allows us to show profile pictures cross-domain.

It’s a very simple operation and just requires some basic PowerShell skills. Basically all you need to do is to set the CrossDomainPhotosEnabled property on the SPWebApplication object to true, like this:

asnp Microsoft.SharePoint.PowerShell
$wa = Get-SPWebApplication http://intranet.contoso.com
$wa.CrossDomainPhotosEnabled = $true
$wa.Update()

After that you can render MySite profile picture by following steps given in this article.

For more information on Powershell for Windows Online, click here

  • It is not on On-premise. Anyway I have tried this very first when I was facing this issue. It didn't solve my problem. – Rare Solutions Feb 18 '15 at 1:38

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.