Forum Discussion

Mikel_17's avatar
Mikel_17
Copper Contributor
Jan 19, 2022

User Photo URL

Hello I hope you can help me with a question, we developed a web part that shows the user's photo, the photo is obtained from "https://tenant.sharepoint.com/_layouts/15/userphoto.aspx?size=M&username=name.lastname@ domain.com" The problem we have is that the users do not have access to "https://tenant.sharepoint.com", is there any other way to get the user's photo?

 

Thanks

4 Replies

  • João Miguel's avatar
    João Miguel
    Copper Contributor

    Mikel_17 

    Hi, 

    It's a bit too late to help you but it might come in handy for others.

    _layouts/15/ is a folder inside the server (C:\program files\common files\microsoft shared\web server extensions\15\template\layouts\) and it's available for all of the site collections.
     
    So, you can access it from any site collection that the user has access to.
    https://tenant.sharepoint.com/
    https://tenant.sharepoint.com/
    https://tenant.sharepoint.com/

    All addresses can be used to get the user photo or any of the services and pages included in _layouts.
     
  • Hello,
    I tested on my tenant and could get my own and others' photos, why do you say your users don't have access to the url?
    • Mikel_17's avatar
      Mikel_17
      Copper Contributor

      AndresGorzelany 

       

      Access to the site (https://tenant.sharepoint.com) was disabled for tenant users, since it is a site that is not being used, only global administrators have access to that site. With users who are global administrators the webpart works without problems. The webpart does is to look for the user's photo to display it, but since the user does not have access to the site (https://tenant.sharepoint.com), the webpart fails. We gave access to the site (https://tenant.sharepoint.com) to a user with the problem, and immediately the web part worked correctly. So we are checking if the user's photo can only be obtained from the tenant's site (https://tenant.sharepoint.com)

Resources