i have a custom list definition which works fine, i have also made a custom webpart which i would like included on the Allitems.aspx page by default when a list is created from the list definition. I seemingly however cannot get this to happen. is it possible? SharePoint 2007 here.

I've tried adding the following under the Allitems.aspx view in the lsit definitions Schema.xml file.

<AllUsersWebPart WebPartZoneID="Main" WebPartOrder="0"> <![CDATA[ <webParts> <webPart xmlns="http://schemas.microsoft.com/WebPart/v3"> <metaData> <type name="WIPRecordsLocation.WIPRecordsLocation" /> <importErrorMessage>Cannot import this Web Part.</importErrorMessage> </metaData> <data> <properties> <property name="AllowEdit" type="bool">True</property> <property name="ChromeType" type="chrometype">Default</property>
</properties> </data> </webPart> </webParts>]]>

But it just never appears on the page even after iisresetting and creating a new list based on my list definition file.

Any help greatly appreciated.

2 Answers 2


Typical, spent days and days trying to resolve this, i post here and then manage to resolve it myself.

After reading some Microsoft documentation it would seem all examples i've seen on the internet miss out one key thing,

Inside the tag or tag for where you want the webpart to appear there needs to be the tag and then all of the above (minus the tag i listed) need to be inside that.

So for example:

        <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,All_Documents;" DefaultView="TRUE" MobileView="True" MobileDefaultView="True" ImageUrl="/_layouts/images/dlicon.png" Url="Forms/AllItems.aspx"><!-- _locID@DisplayName="camlidDc1" _locComment=" " -->
                <AllUsersWebPart WebPartOrder="0" WebPartZoneID="Main">
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
      <type name="WIPRecordsLocation.WIPRecordsLocation, WIPRecordsLocation, Version=, Culture=neutral, PublicKeyToken=d53e342ce9f6b254" />
      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
        <property name="AllowZoneChange" type="bool">True</property>
        <property name="RecordsLocation" type="string">file://dac.mod.uk/dafs</property>
        <property name="ExportMode" type="exportmode">All</property>
        <property name="HelpUrl" type="string" />
        <property name="Hidden" type="bool">False</property>
        <property name="TitleUrl" type="string" />
        <property name="AllowConnect" type="bool">True</property>
        <property name="Description" type="string" />
        <property name="AllowHide" type="bool">True</property>
        <property name="AllowMinimize" type="bool">True</property>
        <property name="Title" type="string">WIPRecordsLocation</property>
        <property name="ChromeType" type="chrometype">Default</property>
        <property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
        <property name="Width" type="string" />
        <property name="Height" type="string" />
        <property name="HelpMode" type="helpmode">Modeless</property>
        <property name="CatalogIconImageUrl" type="string" />
        <property name="AllowEdit" type="bool">True</property>
        <property name="TitleIconImageUrl" type="string" />
        <property name="Direction" type="direction">NotSet</property>
        <property name="AllowClose" type="bool">True</property>
        <property name="ChromeState" type="chromestate">Normal</property>

I don't think it will work by adding the web part to the Schema.xml.

Try using a feature receiver instead to create the web part and add it to the page with SPLimitedWebPartManager. See [MSDN: Add a WebPart to schema.xml][1] for example code.

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.