SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to populate a list that is created as part of a custom site definition from another source. Ive tried using a feature receiver but it states that the list has not been created. I guess that the featureactivated event is triggered before the list has been provisioned. How can i get custom code to run once the site creation has been fully completed.

share|improve this question

You can add default data in the list instance itself.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
  <ListInstance Title="Equipment Availability"
                Description="My List Instance">
          <Field Name ="Title">Projector</Field>
          <Field Name ="EquipmentDescription">
            High Definition Projector with built-in speaker.
          <Field Name ="EquipmentAvailable">TRUE</Field>
          <Field Name ="Title">Wired Microphone</Field>
          <Field Name ="EquipmentDescription">Dynamic Voice Microphone.
          <Field Name ="EquipmentAvailable">FALSE</Field>
          <Field Name ="Title">Wireless Microphone System</Field>
          <Field Name ="EquipmentDescription">
            Two hand held microphones and VHF receiver system.
          <Field Name ="EquipmentAvailable">TRUE</Field>

Refer: List Instance with default data

share|improve this answer

If your List is provisioned via a feature, you can add data to the list instance check out this question it has a sample of what you might be looking for.

share|improve this answer
Im not sure this is going to work. The list is provisioned via a feature but it is used all over our farm. I only need to prepopulate the list when its used on this specific site definition – Richard Banks Mar 19 '13 at 16:07
Well you can try to do this: 1 - Create a feature with an instance of this list type 2 - This specific instance has the data you need. 3 - If you're working with site templates I suppose you know that you can define which features should be activated on the site creation. If you don't, let me know and I'll post an example of a site template I have. Cheers! – Jaime Mar 19 '13 at 16:15

The data loading should be in a feature. Use a WebTemplate to provision the site.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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