UserCustomActionCollection Class
Represents a collection of UserCustomAction objects.
Inheritance Hierarchy
System.Object
Microsoft.SharePoint.Client.ClientObject
Microsoft.SharePoint.Client.ClientObjectCollection
Microsoft.SharePoint.Client.ClientObjectCollection<UserCustomAction>
Microsoft.SharePoint.Client.UserCustomActionCollection
Namespace: Microsoft.SharePoint.Client
Assemblies: Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll); Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
Syntax
'Declaration
<ScriptTypeAttribute("SP.UserCustomActionCollection", ServerTypeId := "{70d1cb2d-d304-4d96-9b54-74b3f400fa28}")> _
Public Class UserCustomActionCollection _
Inherits ClientObjectCollection(Of UserCustomAction)
'Usage
Dim instance As UserCustomActionCollection
[ScriptTypeAttribute("SP.UserCustomActionCollection", ServerTypeId = "{70d1cb2d-d304-4d96-9b54-74b3f400fa28}")]
public class UserCustomActionCollection : ClientObjectCollection<UserCustomAction>
Examples
This code example adds a new menu item to the Site Actions menu of the specified site.
using System;
using Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointFoundation.Samples
{
class UserCustomActionCollectionExample
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
Web site = clientContext.Web;
UserCustomActionCollection collUCA = site.UserCustomActions;
UserCustomAction newUCA = collUCA.Add();
newUCA.Location = "Microsoft.SharePoint.StandardMenu";
newUCA.Group = "SiteActions";
newUCA.Sequence = 1000;
newUCA.Title = "New Menu Item";
newUCA.ImageUrl = "/_layouts/images/myIcon.jpg";
newUCA.Description = "Menu item added";
newUCA.Url = "/_layouts/create.aspx";
newUCA.Update();
clientContext.ExecuteQuery();
Console.WriteLine("New menu item added to Site Actions menu.\n\nTo view the new menu item, refresh the page.");
}
}
}
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.