Exemple #1
0
        /// <summary>
        /// Create a content
        /// </summary>
        /// <param name="web"></param>
        /// <param name="name"></param>
        /// <param name="groupName"></param>
        /// <param name="parent"></param>
        /// <param name="columnSite"></param>
        /// <param name="guidContentType"></param>
        /// <returns></returns>
        public static bool CreateContentType(this SPWeb web, string name, string groupName, string parent, IList <ConfigurationColumn> columnSite,
                                             string guidContentType)
        {
            try
            {
                var result      = false;
                var contentType = new Entities.Artefacts.ContentType(web, Logger, name, groupName, parent);
                contentType.Create(guidContentType);
                foreach (var item in columnSite)
                {
                    result =
                        contentType.AddColumn((!item.Prefix)?item.Name:string.Concat(Constants.Prefix, item.Name));
                }

                return(result);
            }
            catch (Exception exception)
            {
                Logger.Error(string.Concat("Error CreateContentType", exception.Message));
                return(false);
            }
        }
        /// <summary>
        /// Create a content 
        /// </summary>        
        /// <param name="web"></param>
        /// <param name="name"></param>
        /// <param name="groupName"></param>
        /// <param name="parent"></param>
        /// <param name="columnSite"></param>
        /// <param name="guidContentType"></param>
        /// <returns></returns>
        public static bool CreateContentType(this SPWeb web, string name, string groupName, string parent, IList<ConfigurationColumn> columnSite,
          string guidContentType)
        {
            try
            {
                var result = false;
                var contentType = new Entities.Artefacts.ContentType(web, Logger, name, groupName, parent);
                contentType.Create(guidContentType);
                foreach (var item in columnSite)
                {                    
                    result =
                        contentType.AddColumn( (!item.Prefix)?item.Name:string.Concat(Constants.Prefix, item.Name));

                }

                return result;
            }
            catch (Exception exception)
            {
                Logger.Error(string.Concat("Error CreateContentType", exception.Message));
                return false;
            }
        }