无法显示 Sharepoint 列表视图 Web 部件

发布于 2024-08-19 12:59:48 字数 2304 浏览 3 评论 0原文

我有一个功能可以自动创建一些 Web 部件页面。我想在我的 Web 部件页面中显示列表,但无法显示该列表。这是我的 element.xml 文件中的代码:

<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>

我知道我正确设置了页面,因为我将以下内容编辑器 Web 部件放入页面中并显示:

<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> 

我在日志中收到以下错误: 信息不足确定模块“(null)”的列表。假设没有此模块的列表。

我做错了什么?


更多详情: 当我使用时,

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

我没有收到任何错误,但我的页面上没有显示任何内容。如果我输入虚假列表名称,则会收到以下错误:
无法完成此操作。

请再试一次。在 Microsoft.SharePoint.Library.SPRequestInternalClass.EnableModuleFromXml(字符串 bstrFeatureDirectory、字符串 bstrUrl、字符串 bstrXML) 在 Microsoft.SharePoint.Library.SPRequest.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML)

我不相信我引用的先前错误与我的问题有关。我之前发布的错误是


我相信我需要在我的功能的 elements.xml 文件中创建一个 ListInstance 元素。我将以下内容添加到文件顶部:

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

我收到以下错误: 给定列表属性“链接”,无法在文件“Tab3.aspx”的模块中找到合适的标记列表。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦行七里 2024-08-26 12:59:48

该列表位于哪里?您可能需要指定 Web 名称,可能是通过 Guid。如果“列表”是网络,那么一旦您引用它,您只需要列表名称,即“链接”

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'

最终幸福 2024-08-26 12:59:48

我的解决方案是在 Sharepoint Designer 中创建页面,然后将代码复制到功能 aspx 页面中。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文