1

这是我的情况:

我在 SharePoint 2007 Enterprise 中工作,我有一个功能可以在我部署和激活它时为我创建一个列表。到目前为止,我通常的工作流程是部署解决方案、激活它,然后打开 SharePoint Designer 来自定义列表。

我的自定义通常非常复杂,但我会保持简单。在这种情况下,假设我编辑AllItems.aspx,将数据视图转换为 XSLT 数据视图,然后添加一列带有静态文本。

我使用了一些不同的工具(SPSource、VSeWSS、SharePoint Manager、OCDExportList 等)来提取我的自定义schema.xml视图和所有默认视图,但我还没有运气弄清楚代码的AllItems.aspx位置定制。

当我提取(使用上述任何工具)时AllItems.aspx与默认值没有什么不同。schema.xml 中的<View>元素缩减为一行,例如:

<View DefaultView="TRUE" 
      MobileView="TRUE" 
      MobileDefaultView="TRUE" 
      Type="HTML" 
      FPModified="TRUE" 
      DisplayName="All Documents" 
      Url="Forms/AllItems.aspx" 
      Level="1" 
      ContentTypeID="0x" />

我真的被困在这里......我不知道该怎么做。甚至可能吗?如果我可以在我的功能中包含我的自定义设置,它将为我节省大量时间(和文档)。

如果我缺少任何其他有用的信息,请告诉我...谢谢!


最新发现

在过去的几个小时里,我发现了更多。如果我将列表保存为列表模板,然后将 .stp 文件在本地保存为 .cab 文件,我可以提取其内容。其中一个文件manifest.xml包含schema.xml以及其他一些部分。

其中一个部分是每个视图<webparts>都有一个部分。<webpart>这些<webpart>元素中的每一个都包含一串很长的字符……不知道这些字符实际代表什么。

重要的是,如果将任何自定义视图部署为解决方案的一部分,我认为任何自定义视图实际上都必须是 Web 部件……但我并不肯定。

4

3 回答 3

1

I have faced a similar issue a while ago. I had to create a very customized view and I had to give up the ListFormWebPart completely, and have created my own webpart to render the data.

Generally, when you customize the aspx file in SPDesigner, all your changes will be in the aspx file itself. Open it in SPDesigner and you will see there all the changes you have made. After you have converted to the XSL Data View, the standard ListFormWebPart is replaced by a DataFormWebPart, which doesn't care about the <View> tags specified in the schema.xml; Look in the aspx file itself for the ListFormWebPart.

Why not do all the customizations you want on a list, save the list as a template (it will include the associated AllItems.aspx) and then use that template in your feature to create your list? You could add the extracolumn from code (if it's dynamic and cannot be included in the template), and so on.

于 2009-05-05T15:45:21.663 回答
1

是的你可以。从 Codeplex http://spm.codeplex.com/获取 Sharepoint 管理器工具

将它安装在您农场的机器上,它将允许您通过显示所有对象的树视图浏览农场。

通过 Sharepoint GUI 创建列表,然后使用 SPM 浏览到它。

SPM 将允许您提取 MOSS/WSS 创建的描述列表视图的 xml(它显示在左侧属性网格中),然后您可以将其放入 manifest.xml

于 2009-06-04T21:56:31.640 回答
0

我有一个类似的问题,并且一直在对此进行大量研究。对我来说,dataview Web 部件是 Sharepoint 中最强大的组件之一。不幸的是,我必须以 .wsp 包的形式提供我的解决方案,这意味着我不能只创建站点并在该站点上使用 Designer。我采用了两步方法,我使用设计器创建我的数据视图,并且我还编辑了该数据视图的代码以将 ListID 和 Guids 替换为 ListName 和实际列表名称。只要列表名称相同,它就可以在任何页面/站点中导出和使用。我也在我的解决方案中创建了一个 webpart 页面文档库,我相信我可以使用 onet.xml 文件将具有 webparts 的页面添加到该库中。我会尽快获得该测试的结果。

于 2009-05-30T08:04:16.797 回答