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)
ELEMENTS
<?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. --> <ListTemplate Name="LinkListTemplate" Type="10002" BaseType="0" OnQuickLaunch="TRUE" SecurityBits="11" Sequence="410" DisplayName="Link List Template" Description="Used to create a list of links that can be activated/deactivated" Image="/_layouts/images/itgen.png"/> <ContentType ID="0x010018514517A2D0410CA21FAEAB9E113CB1" Name="Link Item" Group="Custom Content Types" Description="Link Item" Version="0"> <FieldRefs> <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" /> </FieldRefs> </ContentType> </Elements>
SCHEMA
<?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/"> <MetaData> <ContentTypes> <ContentTypeRef ID="0x010018514517A2D0410CA21FAEAB9E113CB1" /> </ContentTypes> <Fields> <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" /> </Fields> <Views> <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE"> <Toolbar Type="Standard" /> <XslLink Default="TRUE">main.xsl</XslLink> <RowLimit Paged="TRUE">30</RowLimit> <ViewFields> <FieldRef Name="LinkTitleNoMenu"></FieldRef> </ViewFields> <Query> <OrderBy> <FieldRef Name="Modified" Ascending="FALSE"></FieldRef> </OrderBy> </Query> <ParameterBindings> <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" /> <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /> <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" /> </ParameterBindings> </View> <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> <ViewFields> <FieldRef ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" /> <FieldRef ID="{666C957F-CF3E-4F6A-A8AF-A3E81DAA292C}" /> </ViewFields> <Query> <OrderBy> <FieldRef Name="ID"></FieldRef> </OrderBy> </Query> <ParameterBindings> <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /> <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /> </ParameterBindings> </View> </Views> <Forms> <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" /> </Forms> </MetaData> </List>