1

我尝试了以下方法,

http://devendra-sharepoint.blogspot.in/2012/01/creating-list-programatically-in_30.html

但我无法创建列表。

因为我收到以下错误。

“Microsoft.SharePoint.SPWeb”不包含“EnsureList”的定义,并且找不到接受“Microsoft.SharePoint.SPWeb”类型的第一个参数的扩展方法“EnsureList”(您是否缺少 using 指令或程序集引用?)

请指教。

谢谢,阿赛

4

1 回答 1

0

你可以做这样的事情。

private SPList CreateList(string LName)
  {
    if (spWeb.Lists.TryGetList(LName) == null)
      {
        spWeb.AllowUnsafeUpdates = true;
        spWeb.Lists.Add(LName,"This is Programatically created list", SPListTemplateType.GenericList);
      }
    return spWeb.Lists[LName];
  }

谢谢

于 2013-02-06T09:18:42.097 回答