按组名列出内容类型

时间:2011-01-19 21:07:13

标签: sharepoint-2007

  SPContentTypeCollection ctc=web.ContentTypes;
  string id = string.Empty;
  foreach (SPContentType item in ctc)
  {
    if (string.Equals(item.Group.ToString(),"Custom CT"))
    {
      id = item.Id.ToString();
      break;
    }

为什么id = item.id.tostring()无效。 if语句中出错了。

1 个答案:

答案 0 :(得分:0)

代码很好。 CT组名称拼写错误,这就是为什么我没有获得该组的所有内容类型。

相关问题