This topic has not yet been rated - Rate this topic

PersonalActions Class

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 PersonalActions : ToolBarMenuButton, 
	IPreRenderOverride
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
PersonalActions
Description

The Microsoft.SharePoint.WebControls.PersonalActions class inherits from the IPreRenderOverride interface to contract the PreRender override and the Microsoft.SharePoint.WebControls.ToolBarMenuButton to represent a menu button. PersonalActions is more widely known as the "Welcome Menu" because Welcome.ascx has a PersonalActions control and is included in the default master pages. 

The PersonalActions control uses several MenuItemTemplate objects in order to build a presentation layer. In order to build the required authentication pieces there are several security tests that are performed in order to determine what MenuItemTemplate to toggle based on conditions such as SPSecurity.AuthenticationMode and personalization elements. 

The Usage Scenario

The primary usage of PersonalActions is internal since the class is sealed so cannot be used for derivation. Use of the control within custom development is also found mostly as a reference in master pages or as a value for Microsoft.SharePoint.StandardMenu.Group.ID property. Regardless, PersonalActions can be used in the same manner as any other WebControl.

In the below, I am creating a new PersonalActions object and assigning the control a unique ID. Following, I am adding the PersonalActions control to the current instance control collection.

C# Code Example 

protected override void CreateChildControls()
{
PersonalActions actions = new PersonalActions();
actions.ID = "MyActions";
Controls.Add(actions);
}

Visual Basic .NET Code Example

Protected Overloads Overrides Sub CreateChildControls()
Dim actions As New PersonalActions()
actions.ID = "MyActions"
Controls.Add(actions)
End Sub

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