UserCustomAction 类

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

继承层次结构

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.UserCustomAction

命名空间:  Microsoft.SharePoint.Client
程序集:   Microsoft.SharePoint.Client.Silverlight(位于 Microsoft.SharePoint.Client.Silverlight.dll 中);  Microsoft.SharePoint.Client.Phone(位于 Microsoft.SharePoint.Client.Phone.dll 中)  Microsoft.SharePoint.Client(位于 Microsoft.SharePoint.Client.dll 中)

语法

声明
Public Class UserCustomAction _
    Inherits ClientObject
用法
Dim instance As UserCustomAction
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";
            newUCA.Update();

            clientContext.ExecuteQuery();

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

线程安全性

该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

引用

UserCustomAction 成员

Microsoft.SharePoint.Client 命名空间