如何在列表上方显示 SharePoint 文件夹的元数据

发布于 2024-09-08 17:35:04 字数 273 浏览 1 评论 0原文

我在 SharePoint 2007 中创建了自己的内容类型,该类型基于文件夹类型。然后,我通过添加“描述”富文本字段来配合文件夹标题来扩展它。

导航文件夹层次结构时,我想在显示的自定义文件夹中的子项目/文件夹的列表/视图上方显示此“描述”。这可能吗?看起来应该很容易,但我在尝试解决这个问题上花了很长时间。

我是否需要更改 SharePoint Designer 中的 AllItems.aspx 页面?如果是的话我要添加什么?

杰克

[SharePoint 菜鸟]

I've created my own Content Type in SharePoint 2007 which is based on the Folder type. I've then extended it by adding a "Description" rich text field to accompany the Folder's title.

When navigating the folder hierarchy I want to show this "description" above the List/View of child Items/Folders in the custom Folder being shown. Is this possible? Seems like it should be easy but I'm having a hell of a time trying to work it out.

Do I need to change the AllItems.aspx page in SharePoint Designer? If so what do I add to it?

Jake

[SharePoint noob]

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

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

发布评论

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

评论(2

巴黎盛开的樱花 2024-09-15 17:35:04

老实说,在自定义这样的视图时,您需要查看数据视图 Web 部件。这是一个基于 XML/XSL 的 Web 部件,允许您使用 XSL 指向各种 SharePoint 数据源并以您想要的任何方式呈现数据。 SharePoint 设计器是此操作的首选工具。

这里有很好的概述

Clicky

希望这能让你开始,
问候,
谢恩

To be honest, when customizing views like this you need to look at a data view webpart. This is an XML/XSL based webpart that allows you to point at various SharePoint datasources and render the data whatever way you want using XSL. SharePoint designer is the tool of choice for this operation.

Good overview here

Clicky

Hope this gets you started,
Regards,
Shane

愿得七秒忆 2024-09-15 17:35:04

我想我可能已经在这里回答了我自己的问题。

我使用 WSPBuilder 创建了一个自定义 Web 部件,然后将其添加到列表/视图部件上方的 AllItems.aspx 页面中。该 Web 部件的代码是:

//Find the folder item for the current page.
String rootFolder = Page.Request.QueryString["RootFolder"];

if (!String.IsNullOrEmpty(rootFolder))
{

    SPWeb myWeb = SPContext.Current.Web;
    SPFolder folder = myWeb.GetFolder(rootFolder);

    if (folder.Exists && folder.Item.ContentType.Name.Equals("MyFolder"))
    {

        base.CreateChildControls();

        this.Style.Add(HtmlTextWriterStyle.Margin, "1em");

        SPField field = (SPField)folder.Item.Fields["Folder Description"];
        this.Controls.Add(new LiteralControl(field.GetFieldValueAsHtml(folder.Item["Folder Description"])));

    }
    else
    {
        this.Hidden = true;
    }
}
else
{
    this.Hidden = true;
}

如您所见,我在列表中使用的文件夹基于名为“MyFolder”的自定义内容类型(基于“文件夹”内容类型),并且有一个名为“文件夹说明”。现在,当我浏览列表的文件夹结构时,每个文件夹的描述都会显示在视图上方。欢呼。

杰克

Think I might have answered my own question here.

I used WSPBuilder to create a custom Web Part, which I then added to the AllItems.aspx page just above the List/View part. The code for that Web Part is:

//Find the folder item for the current page.
String rootFolder = Page.Request.QueryString["RootFolder"];

if (!String.IsNullOrEmpty(rootFolder))
{

    SPWeb myWeb = SPContext.Current.Web;
    SPFolder folder = myWeb.GetFolder(rootFolder);

    if (folder.Exists && folder.Item.ContentType.Name.Equals("MyFolder"))
    {

        base.CreateChildControls();

        this.Style.Add(HtmlTextWriterStyle.Margin, "1em");

        SPField field = (SPField)folder.Item.Fields["Folder Description"];
        this.Controls.Add(new LiteralControl(field.GetFieldValueAsHtml(folder.Item["Folder Description"])));

    }
    else
    {
        this.Hidden = true;
    }
}
else
{
    this.Hidden = true;
}

As you can see the folders I'm using within the list are based on a custom Content Type called "MyFolder" (which is based on the "Folder" Content Type) and have a Field called "Folder Description" on them. Now, when I'm navigating the folder structure of the list the description of each folder appears above the View. Hurrah.

Jake

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