Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
UserCustomAction class
Collapse the table of content
Expand the table of content

UserCustomAction class

Represents a custom action associated with a SharePoint list, Web site, or subsite.


Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client.Phone (in Microsoft.SharePoint.Client.Phone.dll)  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

public class UserCustomAction : ClientObject

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 UserCustomActionExample
        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";


            Console.WriteLine("New menu item added to Site Actions menu.\n\nTo view the new menu item, refresh the page.");

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