This topic has not yet been rated - Rate this topic

CreatedModifiedInfo Class

Represents the “create by” and “modified by” information blocks that are rendered at the bottom of display and edit forms.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class CreatedModifiedInfo : FormComponent
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
CreatedModifiedInfo
Description

The Microsoft.SharePoint.WebControls.CreatedModifiedInfo class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which is the foundational control for form and field rendering controls. The CreatedModifiedInfo class is responsible for displaying the customary author and page creation information. 

The CreatedModifiedInfo control works by the use of the SPControlTemplateManager.GetTemplateByName method which will take a string in order to retrieve the corresponding RenderingTemplate. There are three values that are possible for use with the CreatedModifiedInfo control:

"CreatedModifiedInfo" produces:
Created at <Time> by <User> 
Last modified at <Time> by <User>

"CreatedModifiedVersionInfo" produces:
Version: 3.0 
Created at <Time> by <User> 
Last modified at <Time> by <User> 

"CreatedVersionInfo" produces :
Version: 3.0 
Created at <Time> by <User>

By default, "CreatedModifiedVersionInfo" will be used if the SPList.EnableVersioning property is set to true. If not, then the "CreatedModifiedInfo" template is used.

The Usage Scenario

The primary use of CreatedModifiedInfo is when it is desired to have the customary author and page creation information displayed on a page. This is common when extending the default SharePoint list pages with detailed, custom interfaces.

In the below, I am demonstrating the instantiating three CreatedModifiedInfo objects. However, each of the created objects haave different TemplateBasedControl.TemplateName properties that reference the various templates that can be used. After creating the objects, the controls are add to the current instance control collection.

C# Code Example 

protected override void CreateChildControls()
{
CreatedModifiedInfo info1 = new CreatedModifiedInfo();
info1.ID = "CreatedModifiedInfo";
info1.TemplateName = "CreatedModifiedInfo"; 
CreatedModifiedInfo info2 = new CreatedModifiedInfo();
info2.ID = "CreatedModifiedVersionInfo";
info2.TemplateName = "CreatedModifiedVersionInfo"; 
CreatedModifiedInfo info3 = new CreatedModifiedInfo();
info3.ID = "CreatedVersionInfo";
info3.TemplateName = "CreatedVersionInfo"; 
Controls.Add(info1);
Controls.Add(info2);
Controls.Add(info3);
}

Visual Basic .NET Code Example

Protected Overloads Overrides Sub CreateChildControls()
Dim info1 As New CreatedModifiedInfo()
info1.ID = "CreatedModifiedInfo"
info1.TemplateName = "CreatedModifiedInfo"

Dim info2 As New CreatedModifiedInfo()
info2.ID = "CreatedModifiedVersionInfo"
info2.TemplateName = "CreatedModifiedVersionInfo"

Dim info3 As New CreatedModifiedInfo()
info3.ID = "CreatedVersionInfo"
info3.TemplateName = "CreatedVersionInfo"

Controls.Add(info1)
Controls.Add(info2)
Controls.Add(info3)
End Sub

Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com