开发者

List content type by group name

开发者 https://www.devze.com 2023-02-06 03:40 出处:网络
SPContentTypeCollection ctc=web.ContentTypes; string id = string.Empty; foreach (SPContentType item in ctc)
  SPContentTypeCollection ctc=web.ContentTypes;
  string id = string.Empty;
  foreach (SPContentType item in ctc)
  {
    if (string.Equals(item.Group.ToStr开发者_开发百科ing(),"Custom CT"))
    {
      id = item.Id.ToString();
      break;
    }

Why is the id = item.id.tostring() not working. Something's wrong in the if statement.


The code is fine. There was a misspelling for the CT group name that's why I wasn't getting all the content types for that group.

0

精彩评论

暂无评论...
验证码 换一张
取 消