views:

562

answers:

4

I have a feature that automatically creates some web part pages. I want to display a list in my web part page but I can't get the list to show up. Here is my code in my element.xml file:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <Module Path="PageTemplates" Url="" > 

    <File Url="Tab3.aspx" Name="Tab3.aspx" Type="Ghostable" >      
 <View List="Lists/Links"                        
             BaseViewID="0"
             WebPartZoneID="Left" 
              WebPartOrder="0"/>  
    </File>
  </Module>
</Elements>

I know i set up the page correctly because I put the following content editor web part into the page and it shows up:

<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="0">      
    <![CDATA[         
        <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"
                 xmlns:cewp="http://schemas.microsoft.com/WebPart/v2/ContentEditor"&gt;
            <Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
            <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
            <Title>Some content that you want to provision with the feature</Title>
            <FrameType>TitleBarOnly</FrameType>
            <cewp:Content>
              Hello world.
            </cewp:Content>
        </WebPart>
    ]]>       
</AllUsersWebPart> 

I'm getting the following error in the log: Not enough information to determine a list for module "(null)". Assuming no list for this module.

What am I doing wrong?

A: 

Where is that list located? You may need to specify the web name, probably by Guid. If 'lists' is the web then once you reference this you only need the list name, i.e. 'links'

Aquinas
It's just an out of the box Links list. I've tried just "Links" and "Lists/Links"
DL
According to the MSDN, the View tag does not take a GUID. The following is a description of the List attribute. I've tried the ListID as well. Optional Integer or Text . Specifies the type of list. This value can be either the ID of the template for a list (an integer), or the URL to a list provisioned in the site (a string). Best practice is to use Text , because Integer might not be specific enough (e.g., if there are two announcements lists in the site and you specify List=104 ).http://msdn.microsoft.com/en-us/library/ms438074.aspx
DL
A: 

I believe I need to create a ListInstance element in elements.xml file of my feature. I added the following to the top of my file:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <ListInstance
      FeatureId="6A9FB262-8EAD-46C1-814B-7FED72D34EBF"
      Id="Links"
      Url="Links"
      Title="Links"
      TemplateType="103"/>
....

I get the following error: Failed to find a suitable list for tag in module for file 'Tab3.aspx' given List attribute 'Links'.

DL
A: 

More details: When I use

<View List="Lists/Links"...> 

I get no error but nothing shows up on my page. if I enter a bogus list name I get the following error:
Cannot complete this action.

Please try again. at Microsoft.SharePoint.Library.SPRequestInternalClass.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML) at Microsoft.SharePoint.Library.SPRequest.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML)

I don't believe the previous error I quoted is related to my problem. The error I posted before was

DL
A: 

My solution was to create the page in Sharepoint Designer and then copy the code into the feature aspx page.

DL