コード例 #1
0
        public static SPContentType CreateContentType(this SPWeb web,
                                                      SPContentTypeId parentContentTypeId,
                                                      string ctName,
                                                      string group,
                                                      Action <SPContentType> action,
                                                      bool updateChildren = false)
        {
            return(web.CreateContentType(parentContentTypeId, ctName,
                                         contentType =>
            {
                if (!string.IsNullOrEmpty(group))
                {
                    contentType.Group = group;
                }

                if (action != null)
                {
                    action(contentType);
                }
            },
                                         updateChildren));
        }