csharp SPList添加

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp SPList添加相关的知识,希望对你有一定的参考价值。

     // Name, type, and description of list to create.
    private static string lstName = "Customers";
    private static SPListTemplateType lstType = SPListTemplateType.Contacts;
    private static string lstDesc = "A list of customers.";
    
    // Create a list.
    SPListCollection lists = web.Lists;
    Guid listID = lists.Add(lstName, lstDesc, lstType);
    SPList list = lists[listID];
    list.OnQuickLaunch = true;
    list.Update();
    Console.WriteLine("Created {0} list.", list.Title);
 // Apply the new content type to the list.
  list.ContentTypesEnabled = true;
  if (list.IsContentTypeAllowed(ct))
  {
     // Add the new content type.
     SPContentType lstCT = list.ContentTypes.Add(ct);
     // Remove the default content type.
     list.ContentTypes[0].Delete();
     // Commit changes to the list.
     list.Update();
     Console.WriteLine("Applied {0} content type to {1} list.",
                        lstCT.Name, list.Title);
  }
  else
  {
     Console.WriteLine("{0} list does not allow {1} content type.",
                        list.Title, ct.Name);
  }

以上是关于csharp SPList添加的主要内容,如果未能解决你的问题,请参考以下文章

在Ruby中使用Hashtable到JSON

将 VS2012 中的 GridView 表填充为带有 SPList Only Title 列的 webpart 具有值

csharp GameState和添加事件

csharp 将脚本添加到pdf

csharp 添加多个相同数组

csharp 将用户添加到调查中