When editing ChoiceList items of existing UserProfile properties you also need to increment the MaximumShown property. Otherwise the changes (neiter removal nor addition) will be saved when calling Commit().
This won’t work:
// Get the property from the UserProfileManager instance Property property = userProfileManager.PropertiesWithSection.GetPropertyByName("MyExistingProperty") // Remove old choice items property.ChoiceList.Remove("Old Choice 1"); property.ChoiceList.Remove("Old Choice 2"); // Add new choice items property.ChoiceList.Add("New Choice 1"); property.ChoiceList.Add("New Choice 2"); // Save the property property.Commit();
This will work:
// Get the property from the UserProfileManager instance Property property = userProfileManager.PropertiesWithSection.GetPropertyByName("MyExistingProperty") // Remove old choice items property.ChoiceList.Remove("Old Choice 1"); property.ChoiceList.Remove("Old Choice 2"); // Add new choice items property.ChoiceList.Add("New Choice 1"); property.ChoiceList.Add("New Choice 2"); // Increase MaximumShown by the amount of properties that were added (ignore the number of properties removed) property.MaximumShown += 2; // Save the property property.Commit();