/// <summary> /// Creates the content type with a new instance of SPSite because the updates from the last content type changes were not propagated from the database. /// </summary> /// <param name="contentTypeInfo">The content type information.</param> /// <param name="site">The site.</param> /// <returns> /// Return ContentType /// </returns> public SPContentType CreateContentType(ContentTypeInfo contentTypeInfo, SPSite site) { SPContentType contentType = null; using (var newSite = new SPSite(site.ID)) { contentType = this.EnsureContentType( newSite.RootWeb.ContentTypes, contentTypeInfo.ContentTypeId, contentTypeInfo.TitleResourceString); this.EnsureFieldInContentType(contentType, contentTypeInfo.Fields); contentType.Description = contentTypeInfo.DescriptionResourceString; contentType.Group = contentTypeInfo.ContentGroupResourceString; contentType.Update(); } return contentType; }
public SPContentType EnsureContentType(SPContentTypeCollection contentTypeCollection, ContentTypeInfo contentTypeInfo) { SPContentType contentType = this.EnsureContentType( contentTypeCollection, contentTypeInfo.ContentTypeId, contentTypeInfo.TitleResourceString); this.EnsureFieldInContentType(contentType, contentTypeInfo.Fields); contentType.Description = contentTypeInfo.DescriptionResourceString; contentType.Group = contentTypeInfo.ContentGroupResourceString; contentType.Update(); return contentType; }