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:
02 | Property property = userProfileManager.PropertiesWithSection.GetPropertyByName( "MyExistingProperty" ) |
04 | property.ChoiceList.Remove( "Old Choice 1" ); |
05 | property.ChoiceList.Remove( "Old Choice 2" ); |
07 | property.ChoiceList.Add( "New Choice 1" ); |
08 | property.ChoiceList.Add( "New Choice 2" ); |
This will work:
02 | Property property = userProfileManager.PropertiesWithSection.GetPropertyByName( "MyExistingProperty" ) |
04 | property.ChoiceList.Remove( "Old Choice 1" ); |
05 | property.ChoiceList.Remove( "Old Choice 2" ); |
07 | property.ChoiceList.Add( "New Choice 1" ); |
08 | property.ChoiceList.Add( "New Choice 2" ); |
10 | property.MaximumShown += 2; |
See also: http://blogs.msdn.com/nishand/archive/2007/05/20/updating-userprofile-property-of-type-choicelist.aspx