SharePoint 2010, Office 2010 and Profile Pictures

As many of you will know SharePoint & Office make heavy use of your profile pictures to personalize the experience.  For example, here is my profile photo in my My Site.


I get to set up this stuff up quite often in demo environments & so i thought i would post about the process for doing this.

The first thing is to get the photos into your My Site.  Easiest way to do that is to manually upload it via your profile page.  But you can also use some code to upload the file (use UploadSPFile powershell commandlet) to a document library and then use some more powershell to set the “PictureUrl” profile property property to point at the uploaded file.

Example Uploading Photo:

[Microsoft.SharePoint.SPFile]$file = UploadSPFile -url ([string][string]"http://intranet/my/") -libraryName "User Photos" -filePath "<path to photo to upload here>"

*** UPDATE ***  Get Supporting PS File with UploadSPFile function from here.

Example Setting Profile Property:

$upm = GetProfileManager -url $siteUrl
$up = $upm.GetUserProfile("CONTOSO\danj");

$picturePropertyName = GetProfilePropertyName -UserProfileManager $upm -PropertyName "PictureUrl";

if (-not [System.String]::IsNullOrEmpty($picturePropertyName))
    $PortraitUrl = CombineUrls -baseUrl $file.Web.Url -relUrl $file.ServerRelativeUrl;
    $up.get_Item($picturePropertyName).Value = $PortraitUrl;

This will simply set the picture you uploaded as the profile picture.

But wait … there’s more …

You can upload a picture of any dimensions and size … however SharePoint and Office have some images sizes that work best in the UI and SharePoint provides some help to get all your pictures resized to 3 sizes it needs. 96x96 is the largest optimal profile picture size.

SharePoint provides a powershell command to automatically resize all your profile pictures for you.

Example, resizing profile pictures to optimal resolutions:

Update-SPProfilePhotoStore –MySiteHostLocation “http://intranet/my/”

This command will take a look at every users profile picture and will do two things:

  1. Re-Size the photo into the 3 optimal sizes and save them in SharePoint
  2. Set the users profile property to the newly resized photo

Now you should have great looking photos in SharePoint.  Additional tip for getting great photos … make sure you start with a square image.  That way you make use of the optimal viewing window for profile pics in SharePoint.

Now … that is the SharePoint part out of the way.  The next part is getting photos into apps like Outlook and Communicator.

The Exchange blog has a great post on this topic and so i won’t repeat here.  You can read that post here: GAL Photos in Exchange 2010 and Outlook 2010

Here is some additional reading on this topic:

The best part about setting all this up is that people will quickly realize they don’t have a photo set up in SharePoint and will not want to be left out!  Sooner or later you will get nice rich looking SharePoint profiles & pictures for people in Outlook.


Comments (9)

Cancel reply

  1. Richard Marriner says:


     I'm trying to set the picture property for our new SP 2010 server and your post is the nearest thing I've found so far to get things to work. From the MSDN post below, you could see that I have hit a snag with importing properties.

    What I have now done is imported all the staff profile photos to a document library on the server (they are are named the same as the user's login name).

    I have started modifying your script above but can't get it to work (I have never used PowerShell before). I'm getting a few unresilved externals, eg "GetProfileManager". Are they functions that live in another script?

    Basically, I would like to implement something like the pseudocode below:


    foreach $user in Server.AllUserProfiles

    set $user.PictureUrl = "http://server/pics/&quot; + $user.loginName + ".jpg"


    If you could point me in the right direction, I'd *greatly* appreciate it and I'm sure this would help others too!



  2. Phil says:

    Hi Chris,

    You mention to use UploadSPFile powershell commandlet, where can I find this? Similar issue with GetProfileManager and GetProfilePropertyName

  3. Corbett says:

    Chris, where do you get the reference to GetProfileManager and GetProfilePropertyName?  When I run your code the first line has the error "The term 'GetProfileManager' is not recognized as the name of a cmdlet…"

  4. Giles Hamson says:

    Hi,  I was wondering if you could publish the PowerShell scripts you used to update the PictureURL in the User Profile Service.

    Many thanks


  5. TracK says:

    Chris:  Where can I download this UploadSPFile powershell cmdlet you reference above for uploading photos?  I am running SP2010 and do not see it as an available cmdlet.

  6. chjohn says:

    Hi Everyone,

    Please see the update in the blog post for the reference file with the UploadSPFile function referenced.  

    Sorry for the confusion.



  7. Ben says:


    Thank you Chris, for your post.  I was able to upload a picture and set the user profile correctly, but I would like to be able to upload photos to the "Profile Pictures" folder within the "User Photos" picture library.  Would you or anyone else know how to change the SPUtils.ps1 file to allow for that?

    Also, I have not seen where the Update-SPProfilePhotoStore -MySiteHostLocation "http://sp2010/my&quot; command is actually doing anything.  Any recommendations there?



  8. chjohn says:

    Hi Ben,

    The SPProfilePhotoStore should be creating the 3 correctly sized versions of your profile images and storing them in the MySite Host image library.  Take a look there for them.



  9. Ben says:


    Right now my script is uploading the picture to "http://sp2010/my/User Photos", but the location actually used by manually uploading a photo is "http://sp2010/my/User Photos/Profile Pictures".  “Profile Pictures” is a folder within the “User Photos” picture library.  I would prefer to use the “Profile Pictures” directory so that if a user decides to update their photo manually, through the “Edit My Profile” page, it will delete the old photo.  Do you happen to know how the SPUtils could be modified to support uploading to a folder within a picture library?

    Also I checked the Update-SPProfilePhotoStore -MySiteHostLocation "http://sp2010/my&quot; command again, and I'm still not having any luck with it creating the three thumbnails.  I have also successfully implemented a photo resizing method that will create the three thumbnails the exact same dimensions as SharePoint’s built-in resizing.  These can be uploaded and are referenced correctly by SharePoint as well.



Skip to main content