views:

33

answers:

2

Hi,

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]

A: 

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

Shaneo
A: 

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

Jake Howlett
Further to that I've written more on this here:http://www.codestore.net/store.nsf/unid/BLOG-20100707-0446
Jake Howlett