On the MSDN forums I answered a blog posting about how to update some values of a user profile.  I’ve answered this question more than a few times so I threw up this posting about it.

Here is some basic code to achieve this (its actually from MSDN but I’ve written the same code enough times just couldn’t find it offhand)

using (SPSite site = new SPSite("http://servername"))
    ServerContext context = ServerContext.GetContext(site);
    UserProfileManager profileManager = new UserProfileManager(context);
    string sAccount = "domainname\\username";
    UserProfile u = profileManager.GetUserProfile(sAccount);
    u[PropertyConstants.PictureURL].Value = "SOME URL";



Be sure to check out MSDN for the members of the PropertyConstants.

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017 Tony Testa's World