Sharepoint 使用CSOM设置默认内容类型无效

Sharepoint 使用CSOM设置默认内容类型无效,sharepoint,content-type,csom,Sharepoint,Content Type,Csom,我已经在CSOM中创建了新的内容类型,我需要将新创建的内容类型设置为自定义创建的sharepoint列表的默认内容类型。我正在使用下面的代码 List aeList = ctx.Web.Lists.GetByTitle("Project Definition"); var currentCtOrder = aeList.ContentTypes; ctx.Load(currentCtOrder, coll => coll.Include(

我已经在CSOM中创建了新的内容类型,我需要将新创建的内容类型设置为自定义创建的sharepoint列表的默认内容类型。我正在使用下面的代码

List aeList = ctx.Web.Lists.GetByTitle("Project Definition");
var currentCtOrder = aeList.ContentTypes;
ctx.Load(currentCtOrder, coll => coll.Include(
                                 ct => ct.Name,
                                 ct => ct.Id));
ctx.ExecuteQuery();

IList<ContentTypeId> reverseOrder = (from ct in currentCtOrder where ct.Name.Equals("Project Definition", StringComparison.OrdinalIgnoreCase) select ct.Id).ToList();
aeList.RootFolder.UniqueContentTypeOrder = reverseOrder;
aeList.RootFolder.Update();
aeList.Update();
ctx.ExecuteQuery();
List aeList=ctx.Web.Lists.GetByTitle(“项目定义”);
var currentCtOrder=aeList.ContentTypes;
ctx.Load(currentCtOrder,coll=>coll.Include(
ct=>ct.Name,
ct=>ct.Id));
ctx.ExecuteQuery();
IList reverseOrder=(从Currentctor中的ct开始,其中ct.Name.Equals(“项目定义”,StringComparison.OrdinalIgnoreCase)选择ct.Id).ToList();
aeList.RootFolder.UniqueContentTypeOrder=reverseOrder;
aeList.RootFolder.Update();
aeList.Update();
ctx.ExecuteQuery();
但在第5行查询时,代码给出错误提示“System.NotSupportedException:'不支持指定的方法'

有人能帮忙吗?

static void Main(string[]args)
         static void Main(string[] args)
        {
            ClientContext ctx = new ClientContext("http://sp/sites/jerry");
            List list = ctx.Web.Lists.GetByTitle("Documents");
            ChangeContentTypeOrder(ctx, list);

        }
        private static void ChangeContentTypeOrder(ClientContext ctx, List list)
        {
            ContentTypeCollection currentCtOrder = list.ContentTypes;
            ctx.Load(currentCtOrder);
            ctx.ExecuteQuery();

            IList<ContentTypeId> reverceOrder = new List<ContentTypeId>();
            foreach (ContentType ct in currentCtOrder)
            {
                if (ct.Name.Equals("testct"))
                {
                    reverceOrder.Add(ct.Id);
                }
            }
            list.RootFolder.UniqueContentTypeOrder = reverceOrder;
            list.RootFolder.Update();
            list.Update();
            ctx.ExecuteQuery();
        }
{ ClientContext ctx=新的ClientContext(“http://sp/sites/jerry"); List List=ctx.Web.Lists.GetByTitle(“文档”); ChangeContentTypeOrder(ctx,列表); } 私有静态void ChangeContentTypeOrder(ClientContext ctx,列表) { ContentTypeCollection currentCtOrder=list.ContentTypes; 负载(电流调节器); ctx.ExecuteQuery(); IList ReverseCorder=新列表(); foreach(CurrentTolder中的ContentType ct) { if(ct.Name.Equals(“testct”)) { 混响命令添加(ct.Id); } } list.RootFolder.UniqueContentTypeOrder=reversceorder; list.RootFolder.Update(); list.Update(); ctx.ExecuteQuery(); }