I m using custom multivalue propety category_list in user object profile to store categories that are associated to a profile. The end user can assign/unassign category to a user from the UI. My problem is that if the end user unassign all categories from a user then I need to set the multivalue property null or empty but I am unable to do so.

I have tried the following





userprofile.Properties["GeneralInfo.category_list"]=new object[]{};


userprofile.Properties["GeneralInfo.category_list"]=new object[]{string.Empty};


userprofile.Properties["GeneralInfo.category_list"]=new object[]{null};

But none of the above works. some throw exceptions while others set the property to an array having an item in inderminate state.

Please help me .

Re: Commerce Server 2007 Setting multi value prperty to null/empty

Tim Bond

We had the same problem. The solution that we came up with (eventually) was to use DBNull.Value.



this feels really dirty to me - the empty object array really ought to work.

Re: Commerce Server 2007 Setting multi value prperty to null/empty

David Hargis - MSFT

Setting the property value to DBNull.Value is the correct way to empty a list. The profile system does not support empty arrays in multi-valued properties.

- David