Beispiel #1
0
        public static void AddContentType(this SPList list, SPContentTypeId contentTypeId)
        {
            SPContentType contentType = list.ParentWeb.AvailableContentTypes[contentTypeId];

            if (contentType != null)
            {
                list.AddContentType(contentType);
            }
        }
Beispiel #2
0
 private void ContentTypesAction(SPList list, IEnumerable <SPContentType> contentTypes)
 {
     foreach (SPContentType contentType in contentTypes)
     {
         if (!list.ContainsContentTypeWithId(contentType.Id) && list.IsContentTypeAllowed(contentType))
         {
             list.AddContentType(contentType);
         }
     }
 }