缺少using指令或程序集引用(ClientContext) - c#

我正在尝试测试此代码段,但在“ ClientContext oContext = new ClientContext(siteUrl);”上收到“缺少using指令或程序集引用”错误。我直接从Microsoft网站复制和粘贴,所以不确定我缺少什么...

using System;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointServices.Samples
{
    class BreakSecurityInheritance
    {
        static void Main()
        {
            string siteUrl = "http://MyServer/sites/MySiteCollection";
            ClientContext oContext = new ClientContext(siteUrl);
            SP.List oList = oContext.Web.Lists.GetByTitle("Announcements");

            oList.BreakRoleInheritance(true, false);

           oContext.ExecuteQuery();
        }
    }
}

参考方案

如前所述,您需要对SharePoint客户端对象模型的引用。幸运的是,您可以从Microsoft获得这些作为SP Client OM可再发行的一部分,而不必安装完整的本地SharePoint服务器。

http://www.microsoft.com/download/en/details.aspx?id=21786

45码