AAron nAAs

All MindsharpBlogs

AAron's SharePoint notepad

My Links

Archives

Blog Stats

My Sites

Created by / Modified by / Version SharePoint Page Footer

If you want to add some standard Author and Page creation information to your MOSS 2007 page footers, you only have to add the built-in CreatedModifiedInfo control to your master page. It uses SharePoint's standard list view/edit footer, and even add the presence icons to the page for the Authored by and Modified by users. Wow, very "Web 2.0" !!

Example:

<SharePoint:CreatedModifiedInfo id=ModifiedInfo runat="server" TemplateName="CreatedModifiedInfo"/>

Produces:

Created at 1/21/2008 4:25 PM  by System Account   
Last modified at 2/8/2008 2:42 PM  by Aaron Naas  

Example:

<SharePoint:CreatedModifiedInfo id=ModifiedInfo runat="server" TemplateName="CreatedModifiedVersionInfo"/>

Produces:

Version: 3.0   
Created at 1/21/2008 4:25 PM  by 2/8/2008 2:42 PM   
Last modified at 2/8/2008 2:42 PM  by Aaron Naas    

Example:

<SharePoint:CreatedModifiedInfo id=ModifiedInfo runat="server" TemplateName="CreatedVersionInfo"/>

Produces:

Version: 3.0  
Created at System Account  by 1/21/2008 4:25 PM

Strange that the "Created at" username is missing/wrong. The TemplateName of CreatedModifiedVersionInfo (and CreatedVersionInfo) appears to be either limited use or buggy for some scenarios. I suspect that you need to use the TemplateNames that include Version only when the list actually utilizes versioning. Try it on your scenarios, to determine their usefulness for yourself.

For the best results, omit the TemplateName attribute to get the “Appropriate“ (and most compatible) information for the type of list you have. (the id doesn't matter either)

Example:

<SharePoint:CreatedModifiedInfo runat="server"/>

Produces:

Version: 3.0
Created at 1/21/2008 4:25 PM by System Account
Last modified at 2/8/2008 2:42 PM by Aaron Naas

The TemplateName values that are possible are driven by the CreatedModifiedInfo control's use of SPControlTemplateManager.GetTemplateByName(). The manager ultimately use HttpContext.Current.Server.MapPath(systemTemplateLocation)).GetFiles("*.ascx") to load the templates.

UPDATE:

The templates used by CreatedModifiedInfo are stored in 12\TEMPLATES\CONTROLTEMPLATES\DefaultTemplates.ascx. Looking for the standard “CreatedModifiedInfo”yields:

<SharePoint:RenderingTemplate ID="CreatedModifiedInfo" runat="server">

    <Template>

        <table cellpadding=0 cellspacing=0>

            <tr><td nowrap class="ms-descriptiontext" ID=onetidinfoblock1>

                <SharePoint:FormattedString FormatText="<%$Resources:wss,form_createdby%>" runat="server">

                    <SharePoint:FormField ControlMode="Display" FieldName="Created" DisableInputFieldLabel="true" runat="server"/>

                    <SharePoint:FormField ControlMode="Display" FieldName="Author" DisableInputFieldLabel="true" runat="server"/>

                    <SharePoint:CreationType runat="server"/>

                </SharePoint:FormattedString>

            </td></tr>

            <tr><td nowrap class="ms-descriptiontext" ID=onetidinfoblock2>

                <SharePoint:FormattedString FormatText="<%$Resources:wss,form_modifiedby%>" runat="server">

                    <SharePoint:FormField ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server"/>

                    <SharePoint:FormField ControlMode="Display" FieldName="Editor" DisableInputFieldLabel="true" runat="server"/>

                </SharePoint:FormattedString>

            </td></tr>

        </table>

    </Template>

</SharePoint:RenderingTemplate>

Finally, if you want to use a one-off custom template, embed a similar template directly into the CreatedModifiedInfo body with “CustomTemplate“:

<SharePoint:CreatedModifiedInfo ControlMode="Display" runat="server">

    <CustomTemplate>

        <table cellpadding=0 cellspacing=0>

            <tr><td nowrap class="ms-descriptiontext">

                <SharePoint:FormattedString FormatText="Author: {0}" runat="server">

                    <SharePoint:FormField ControlMode="Display" FieldName="Editor" DisableInputFieldLabel="true" runat="server"/>

                </SharePoint:FormattedString>

            </td></tr>

            <tr><td nowrap class="ms-descriptiontext">

                <SharePoint:FormattedString FormatText="Date Modified: {0}" runat="server">

                    <SharePoint:FormField ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server"/>

                </SharePoint:FormattedString>

            </td></tr>

        </table>

    </CustomTemplate>

</SharePoint:CreatedModifiedInfo>

References: http://www.cnblogs.com/Sunmoonfire/archive/2007/05/22/755968.html

posted on Friday, February 08, 2008 4:59 PM

Feedback

# SharePoint 2007 Add Last Modified Date to Pages 6/3/2008 1:16 AM jonketo

Adding the last modified date to a SharePoint page is quite simple. Open the page you would like to display...

# re: Created by / Modified by / Version SharePoint Page Footer 8/24/2008 5:54 AM Senan

Thank you, helpfull tip...

Title  
Name  
Url
CAPTCHA
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments