Get user profile picture url
-
06-10-2020 - |
Domanda
I'm using Promoted links Web part and i want to show a user picture on the background of the tile. How can i get the user picture? I'm trying to do this with no code.
The only way to add a picture is to use its url, but if he changes his profil pic the image will no longer exist... Do i have to upload the picture by myself somewhere? Or maybe upload it on sharepoint? But then whenever he changes his picture i will have to change it in my promoted links list too...
how can i achieve his?
Soluzione
By inspecting the source code i noticed the profile pic is set like this: background-image:url(/_layouts/15/userphoto.aspx?size=L&username=usernamehere);
So I used the same url in my promoted links list and when ever a user change his profile picture the url is returning the right pic too.
Because of the cache files the changed pic can't be seen imediatly. So I need to clear it i want to see the new picture. But it works and it's a no code solution.
Altri suggerimenti
Without code, you won't fix the issue on the changing profile picture. With code, you could solve this with https://msdn.microsoft.com/en-us/library/office/jj920104.aspx
You could also think about using a content by search webpart to show people and pictures and somehow filter the result to get the same people.