I am trying to create a custom SharePoint list on feature activation. Though it works fine but I want that if the list with same name already exists it should overwrite that list and create the new one. I want to avoid checking if list already exists code.

Also some of my list columns are of type "Choice". How can i allow multi select values and add choice values for that column?

I am working with SharePoint 2010 and using SPList object.

  • what did you try ?
    – Steve B
    Jun 7, 2012 at 12:46
  • What happens to items in the list if the list already exists? Jun 7, 2012 at 15:09
  • It wont create the list if it already exists.
    – V.B
    Jun 8, 2012 at 5:10

2 Answers 2


I don't think there is an overwrite function. You are going to have to check if one exists first, delete it and then recreate it. Or you could write code to look at the existing one and add/remove any columns or settings as needed.

As for the choice, I've always had the best luck using SPList.Fields.AddFieldAsXml(xml). The format looks something like this:

<Field Type="Choice" DisplayName="Color" Required="FALSE" Format="Dropdown" FillInChoice="FALSE" Name="Color" ColName="nvarchar4">

There is no option for overwriting so you have to remove the old list yourselves.

But I'd suggest you don't do that on feature activation. If you want just to overwrite I assume that your list name/url is very specific to your feature as you'd otherwise risk deleting endusers data. If the list can only be created by your feature and don't contain data needed if the users deactivate/activate the feature then you should delete it in feature deactivation.

To make a choice field allow multiple values you have to set the Format="RadioButtons"


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.