Microsoft.SharePoint.WebCon ...


InformationBar Class (Microsoft.SharePoint.WebControls)

Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class InformationBar
    Inherits FormComponent
Visual Basic (Usage)
Dim instance As InformationBar
C#
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public sealed class InformationBar : FormComponent
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
     Microsoft.SharePoint.WebControls.SPControl
       Microsoft.SharePoint.WebControls.TemplateBasedControl
         Microsoft.SharePoint.WebControls.FormComponent
          Microsoft.SharePoint.WebControls.InformationBar
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Tags :


Community Content

Adam Buenz - MVP
InformationBar

Description
The Microsoft.SharePoint.WebControls.InformationBar sealed class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which provides the derivation for Windows SharePoint Services form-rendering controls.

The InformationBar control provides information regarding a SPListItem object, namely:

FileUploadedMessage – will check SPUtility.IsCheckedOut property if the ItemContext.FormContext.UploadMode mode is in the correct state. If so, a resource managed message is rendered to standard output.

ApprovalMessage – will check if the SPList.EnableModeration property is set to true determining if the form requires approval. If so, a resource managed message is rendered to standard output.

EmailCalendarMessage – will check if the SPList is of SPListTemplateType.Events and whether the SPList.Fields collection contains SPBuiltInFieldId.EmailSender value. If so, a resource managed message is rendered to standard output.

CopySourceInfo – if the ListItem.CopySource is valid, the source information regarding the SPListItem object is rendered to standard output.

AssignToEmailMessage – if the SPList.EnableAssignToEmail a resource managed message is rendered to standard output.

In order to handle the presentation layer of the bar, the Microsoft.SharePoint.WebControls.GenericInformationBar class is used. Inheriting from Microsoft.SharePoint.WebControls.RepeatedControls, GenericInformationBar provides relevant HTML Table creation through literal HTML strings being rendered to standard output, along with other stylistic elements.

Usage Scenario

The primary usage of InformationBar is limited to the shipped software on various SharePoint forms since it provides a wealth of information from a SPlist and SPListItem context. Heaviest representation of the control is found on list related form pages.

When developing custom classes that inherit from FormComponent, usage of the control is also customary. In the below, MyClass is inheriting from FormComponent and the CreateChildControls method is being overridden. The FormMode of the current context is being tested in a switch statement, and if the SPControlMode is set to Display, a new InformationBar object is being created. The InformationBar.ItemContext property is being set to the class instance ItemContext, and the object is then added to the current instance control collection.
C# Code Example

public class MyClass : FormComponent
{
protected override void CreateChildControls()
{
switch (SPContext.Current.FormContext.FormMode)
{
case SPControlMode.Display:
{
InformationBar bar = new InformationBar();
bar.ID = "My Bar";
bar.ItemContext = ItemContext;
Controls.Add(bar);
}
break;
}
}
}

VB.NET Code Example

Public Class [MyClass]
Inherits FormComponent
Protected Overloads Overrides Sub CreateChildControls()
Select Case SPContext.Current.FormContext.FormMode
Case SPControlMode.Display
If True Then
Dim bar As New InformationBar()
bar.ID = "My Bar"
bar.ItemContext = ItemContext
Controls.Add(bar)
End If
Exit Select
End Select
End Sub
End Class
Tags :

Page view tracker