we're doing an upgrade to 2013 and we have some custom code that refers to the Microsoft.SharePoint.Portal.WebControls.ProfileImagePicker control.

This custom code uploads an image into sharepoint from a 3rd party sql database to be used in user profiles.

As you can see in the code below, we are referring to a field m_objWeb which does not seem to exist in the 2013 version of this control (the field can't be found in 2013 and returns null to fi_m_objweb)

private static void InitializeProfileImagePicker(ProfileImagePicker profileImagePicker, SPWeb web) { Type profileImagePickerType = typeof(ProfileImagePicker);

        FieldInfo fi_m_objWeb = profileImagePickerType.GetField("m_objWeb", BindingFlags.NonPublic | BindingFlags.Instance);
        fi_m_objWeb.SetValue(profileImagePicker, web);

        MethodInfo mi_LoadPictureLibraryInternal = profileImagePickerType.GetMethod("LoadPictureLibraryInternal", BindingFlags.NonPublic | BindingFlags.Instance);
        if (mi_LoadPictureLibraryInternal != null)
            mi_LoadPictureLibraryInternal.Invoke(profileImagePicker, new object[] { });

Has this control been deprecated? We only see msdn documentation on it for 2007. What should we be using? Thanks.

An outline of the general approach being used in 2010 can be found at : http://pholpar.wordpress.com/2010/03/10/how-to-upload-a-user-profile-photo-programmatically/

it is kind of a hack and uses reflection

1 Answer 1


We ended up having to rewrite the helper class referencing the deprecated(?) control. A good article that worked for me was Upload User Profile Pictures Programmatically

and don't forget the

userProfile["PictureUrl"].Value = pictureUrl;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.