开发者

Can't display Sharepoint List view webpart

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/">
  <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">
            <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?


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


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/">
  <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'.


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'


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜