Options for SharePoint User Profile Properties and Photos

    As I’ve mentioned, most of these blogs are for my own benefit. My memory isn’t as good as it once was… has something to do with years gone by and only limited space. Smile  It is what it is..

    My customer is working through a migration from Wave 14 (Exchange 2010, Lync 2010, and SharePoint 2010) to Wave 15 (Exchange 2013, Lync 2013, and SharePoint 2013) and the topic of user photos came up. There are a variety of ways to handle this from a technical, philosophical, and legal perspective, but being who I am we’ll stick to technical for now.

    I set up a variety of procedures in my lab and jotted down some notes about the results. Keeping in mind that my focus currently is SharePoint, I’m not discussing Lync 2013 and the only reason I’m discussing Exchange 2013 at all is due to the new integration point that allows the use of high resolution photos. The gist of what I found is below and keep in mind that some of these scenarios are highly unlikely.

    • SP2013 with no connection to User Profile Service App (UPSA)
      • Photo is stored anywhere and the user has a property called “Picture” that stores a URL to the photo in the user’s ListItem for the User Information List (_catalog/users) in the content database


      • User has a menu to “My Settings” which redirects to _layouts/15/Userdisp.aspx which allows editing of the user profile properties


    • SP2013 with connection to UPSA, but no MySite/Personal Site and no Active Directory Synchronization (highly unlikely)

      • Profiles can be manually created in UPSA (or through custom code) and synchronized into the User Information list of each content database via timer jobs
      • Profile properties are editable only through the UPSA (or through custom code)
      • Photos cannot be stored in any ‘out of the box’ method as there is no OOB option for uploading the photos. When attempting to upload a photo through the UPSA, it will error as there is no MySite host Url defined

    • SP2013 with UPSA with AD Sync, but without personal site and MySite
      • This scenario is again unlikely since without the MySite experience there is nowhere to store the photo without a custom coded solution.
      • This scenario does, however, provide us with the ability to synchronize user profile information from AD. Normally low-res photos are stored within the thumbnailPhoto, but again SharePoint has nowhere to store the photo out of the box.   

    • SP2013 with UPSA with personal site and MySite, but no AD Sync


      • After you are on the “About Me” page, clicking “Edit Profile” redirects the user to EditProfile.aspx where properties can be edited and then synchronized from the User Profile database to the content databases and by the SweepSync timer job mentioned above
      • The photo in this scenario is actually stored in the MySite host under a new picture library called “User Photos”


    • SP2013 with full UPSA and sync with AD
      • This blog (one of many that are out there) has steps on implementing this:


      • Basically you are configuring a mapping of the SharePoint property Picture to the Active Directory attribute thumbnailPhoto. This can be configured either as ‘import’ – synchronize from AD to SharePoint – or as ‘export’ – synchronize from SharePoint to AD. After running a profile sync, then you run a powershell cmdlet (Update-SPProfilePhotoStore) to pull the photos and create a photo store within the MySite host (http://<my site url>/user%20photos). 

    • SP2013 photo sync with new Exchange High-Res Photo option
      • *requirement – App Management Service App Proxy in order to create the App Principal that is needed to interact with EWS
      • Photo stored in Exchange mailbox and requested from SharePoint when needed
      • It is also stored as a caching mechanism within the “User Photos” library of the MySite site collection
      • When adding the photo to Exchange (Set-UserPhoto powershell cmdlet) it is stored within the mailbox in multiple image sizes (see chart below) and the lowest resolution is also stored in the AD thumbnail attribute 

      Photo Size

      Width (Pixels)

      Height (Pixels)

      Parameter Value

      Thumbnail (also available in AD)




































      You can retrieve each of the above photo sizes through EWS with the following URL:
      https://<EWS Server>/ews/exchange.asmx/s/GetUserPhoto?email=<user email address>&size=<chart value>
      For example:
      will retrieve the 96×96 pixel image for ‘scottg@contoso.lab’

      Export-SPWeb Syntax Changes Between Root Site and Sub Sites

      Working on a somewhat related issue today and needed to test something with Export-SPWeb. We were trying to import a list from an STP (List template) and in order to get there I decided to export one of my own lists and play around a bit. Much to my surprise I was unable to export a custom list from my lab environment. I kept getting the following error:

      export-spweb : The URL provided is invalid. Only valid URLs that are site collections or sites are allowed to be exported using stsadm.exe.
      At line:1 char:1
      + export-spweb $web -Path exported_list.cmp -ItemUrl “/lists/testlist” -Force +
      + CategoryInfo : InvalidData: (Microsoft.Share…CmdletExportWeb: SPCmdletExportWeb) [Export-SPWeb], SPException
      + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb

      It was quite maddening as the parameters are not that difficult to figure out. (get-help export-spweb)

      So I was trying many things and discovered that in a second lab environment I had that it worked flawlessly and I was determined to discover why. The first thing that a peer of mine found for me was that in the failing environment the web from which I was trying to export the custom list was on a site collection under the ‘sites’ managed path (in other words not the root site). The environment that was working was the root site collection.

      To cut to the chase, you may not be able to use the same syntax depending on where the list resides. The parameter in question that kept failing for me was the ItemUrl parameter. It is to represent the url to the list that you would like to export. Basically if the site collection is the root site collection, then the ItemUrl should contain a leading “/” such as this:

      Export-SPWeb http://intranet.contoso.lab –Path exported_list.cmp –ItemUrl “/Lists/TestList”

      However if the site collection is not the root, then you should either include the full server relative url to the list or the web relative url to the list *without* the leading slash:

      Export-SPWeb http://intranet.contoso.lab/sites/TestImport –Path exported_list.cmp –ItemUrl “/sites/TestImport/Lists/TestList”


      Export-SPWeb http://intranet.contoso.lab/sites/TestImport –Pat exported_list.cmp –ItemUrl “Lists/TestList”

      If you care to know, basically under the covers the Export-SPWeb cmdlet will call SPWeb.GetList(), but prior to calling that function it will prepend the SPWeb.ServerRelativeUrl and an extra “/” if the string in ItemUrl does not have a leading “/”. In short, to be safe if you always set the ItemUrl parameter to the server relative url and then path to the list, it should always work regardless of web location.