1

I've setup a sharepoint site that initially had My Sites turned on. One of our users went in and uploaded a picture for their profile. Then we realized we didn't want to use My Sites, so we turned those features off, and removed any of the profiles created under site/my/profiles. This all worked fine except the reference to the picture (along with other fields like About me, Ask Me About, etc.) still remain. How can I remove these, most importantly the Picture reference? If I click Edit, the only option is to add an attachment.

Thanks in advance!

enter image description here

1

I don't think there is any other way, than creating a script that will remove the picture information from User Profile..

Following code will help:

SPSite site = SPContext.Current.Site;
UserProfileManager userProfileManager = new UserProfileManager(SPServiceContext.GetContext(site));
// accountName is Active Directory account
UserProfile userProfile = userProfileManager.GetUserProfile(accountName);
// PictureUrl is the property you need to set.. set it to Empty string..
userProfile["PictureUrl"].Value = string.Empty;
// commit the change
userProfile.Commit();

Well you can use Client Object Model and write the code as a Console/Windows application.. In that case you will be getting the reference of SPSite accordingly.. You can also port it as a Powershell script..

Reference:

Update User Profile picture programmatically in SharePoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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