I have a custom list definition where i want to use the OOB URL site column plus a site column that i created in another list definition. When i do it and try to display the All Items view it says it can't load the webpart. here is the Schema.xml and Elements.xml in the hopes that someone can tell me what i did wrong. As you see i create a custom content type in the elements.xml that references the two fields (i do use display name to rename the URL field). I then add the contenttyperef in the schema.xml and edit the viewfield and fields. When i create a list off this template and try to display the default view it i get the following error in the ULS. Not sure what is going on/what i did wrong...help appreciated :).

    Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.    
 at Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.AddInFieldSchema(XmlNodeList fieldRefNodes, SPList list)    
 at Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.ModifyXsltArgumentList(ArgumentClassWrapper argList)    
 at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)


    <?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List Definition project item, an error will occur when the project is run. -->
        DisplayName="Link List Template"
        Description="Used to create a list of links that can be activated/deactivated"
        Name="Link Item"
        Group="Custom Content Types"
        Description="Link Item"
          <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" ReadOnly="TRUE" Required="FALSE" Hidden="TRUE" />
          <FieldRef ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" Name="LinkTitle" ReadOnly="TRUE" Required="FALSE" Hidden="TRUE" />
          <FieldRef ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Name="LinkTitleNoMenu" ReadOnly="TRUE" Required="FALSE" Hidden="TRUE" />
          <FieldRef ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Description="URL with Description" DisplayName="URL" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" Required="TRUE" />
          <FieldRef ID="{666C957F-CF3E-4F6A-A8AF-A3E81DAA292C}" Description="Is this URL active" DisplayName="Active" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" />          


<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="Link List Template" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/StElizabethSite-LinkListTemplate" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
      <ContentTypeRef ID="0x010018514517A2D0410CA21FAEAB9E113CB1" />
      <Field Type="URL" ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Description="URL with Description" Name="URL" DisplayName="URL" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" Required="TRUE" />
      <Field Type="Boolean" ID="{666C957F-CF3E-4F6A-A8AF-A3E81DAA292C}" Description="Is this URL active" Name="Active" DisplayName="Active" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" />
      <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
        <Toolbar Type="Standard" />
        <XslLink Default="TRUE">main.xsl</XslLink>
        <RowLimit Paged="TRUE">30</RowLimit>
          <FieldRef Name="LinkTitleNoMenu"></FieldRef>
            <FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
          <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
      <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
        <Toolbar Type="Standard" />
        <XslLink Default="TRUE">main.xsl</XslLink>
        <RowLimit Paged="TRUE">30</RowLimit>
          <FieldRef ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" />
          <FieldRef ID="{666C957F-CF3E-4F6A-A8AF-A3E81DAA292C}" />
            <FieldRef Name="ID"></FieldRef>
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
      <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
      <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
      <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />

2 Answers 2


Your schema.xml is used by SharePoint to create a copy (list version content type) so your schema.xml should copy exactly the same content type definition as you do in elements.xml

Try to copy entire content type definition from elements.xml to "ContentTypes" section of schema.xml

Hope it helps,



According to msdn FieldRef element doesn't have ID attribute, I suppose this is the case... You should provide field internal name instead of ID.

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.