User Photo URL

%3CLINGO-SUB%20id%3D%22lingo-sub-3065857%22%20slang%3D%22en-US%22%3EUser%20Photo%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3065857%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EHello%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EI%20hope%20you%20can%20help%20me%20with%20a%20question%2C%20we%20developed%20a%20web%20part%20that%20shows%20the%20user's%20photo%2C%20the%20photo%20is%20obtained%20from%20%22%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%2F_layouts%2F15%2Fuserphoto.aspx%3Fsize%3DM%26amp%3Busername%3Dname.lastname%40%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%2F_layouts%2F15%2Fuserphoto.aspx%3Fsize%3DM%26amp%3Busername%3Dname.lastname%40%3C%2FA%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%3Edomain.com%22%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EThe%20problem%20we%20have%20is%20that%20the%20users%20do%20not%20have%20access%20to%20%22%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%3C%2FA%3E%22%2C%20is%20there%20any%20other%20way%20to%20get%20the%20user's%20photo%3F%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3065857%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

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

3 Replies
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?

@Andres Gorzelany 

 

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)

Oh I understand better now
Idk how complex is the webpart however, maybe you will need to explore the Graph API to get the Profile Photo?

https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0